Encoding method, decoding method, code stream, encoder, decoder, and storage medium
By introducing the Temporal Adaptive Loop Filtering (TALF) method into video coding, and combining the filtering mode and vector information to obtain the reference position and perform weighted processing, the problem of unsatisfactory filtering effect in the existing technology is solved, and the encoding and decoding performance is improved.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
- Filing Date
- 2024-07-12
- Publication Date
- 2026-04-23
AI Technical Summary
In existing video coding technologies, filters fail to fully utilize the relevant information of the reconstructed image in the temporal domain, resulting in unsatisfactory filtering effects and reduced encoding and decoding performance.
The Temporal Adaptive Loop Filtering (TALF) method is adopted, which combines the vector information of the filtering mode and the sample position to obtain the reference position, and improves the filtering effect through weighted processing, including using motion vectors or block vectors to obtain the reference position and performing weighted calculations.
It improves filtering performance and enhances encoding and decoding performance.
Smart Images

Figure CN2024105263_23042026_PF_FP_ABST
Abstract
Description
Encoding / decoding methods, bitstreams, encoders, decoders, and storage media Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. Background Technology
[0002] In Versatile Video Coding (VVC), in-loop filters include deblocking filters (DBF), sample adaptive offset (SAO), adaptive loop filters (ALF), and cross component adaptive loop filters (CCALF).
[0003] However, common filtering techniques do not fully utilize the relevant information of the reconstructed image in the time domain, resulting in less than ideal filtering effects and reduced encoding and decoding performance.
[0004] Summary of the Invention
[0005] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium, which can improve filtering effects and enhance encoding / decoding performance.
[0006] The technical solution of this application embodiment can be implemented as follows:
[0007] In a first aspect, embodiments of this application provide a decoding method applied to a decoder, the method comprising:
[0008] Given that the current image is filtered using temporal TALF, determine the filter coefficients and the filtering mode;
[0009] Based on the filtering mode and the vector information corresponding to the current position, at least one reference position corresponding to the current position is determined;
[0010] The filtered reconstructed value at the current position is determined by filtering based on the filtering mode, the reconstructed sample at the at least one reference position, and the filter coefficients.
[0011] Secondly, embodiments of this application provide an encoding method applied to an encoder, the method comprising:
[0012] When filtering the current image using TALF, determine the filter coefficients;
[0013] Based on the filtering mode and the vector information corresponding to the current position, at least one reference position corresponding to the current position is determined;
[0014] The filtered reconstructed value at the current position is determined by filtering based on the filtering mode, the reconstructed sample at the at least one reference position, and the filter coefficients.
[0015] Thirdly, embodiments of this application provide a bitstream, which is generated by bit encoding based on information to be encoded; wherein the information to be encoded includes at least: auxiliary filter identification information and a filter mode.
[0016] Fourthly, embodiments of this application provide an encoder, the encoder including a first determining unit; wherein,
[0017] The first determining unit is configured to, when filtering the current image using TALF, determine filter coefficients and a filtering mode; determine at least one reference position corresponding to the current position based on the filtering mode and vector information corresponding to the current position; and perform filtering based on the filtering mode, reconstructed samples of the at least one reference position, and the filter coefficients to determine the filtered reconstructed value of the current position.
[0018] Fifthly, embodiments of this application provide an encoder, which includes a first memory and a first processor; wherein,
[0019] The first memory is used to store computer programs that can run on the first processor;
[0020] The first processor is configured to execute the encoding method described above when running the computer program.
[0021] Sixthly, embodiments of this application provide a decoder, which includes a second determining unit; wherein,
[0022] The second determining unit is configured to, when it is determined that the current image is filtered using TALF, determine filter coefficients and a filtering mode; determine at least one reference position corresponding to the current position based on the filtering mode and vector information corresponding to the current position; and perform filtering based on the filtering mode, the reconstructed samples of the at least one reference position, and the filter coefficients to determine the filtered reconstructed value of the current position.
[0023] Seventhly, embodiments of this application provide a decoder, which includes a second memory and a second processor; wherein,
[0024] The second memory is used to store computer programs that can run on the second processor;
[0025] The second processor is configured to execute the decoding method described above when running the computer program.
[0026] Eighthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed, implements the decoding method as described in the first aspect or the encoding method as described in the second aspect.
[0027] In a ninth aspect, embodiments of this application provide a computer-readable storage medium for storing a bitstream generated by the encoding method described in the first aspect.
[0028] This application provides an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. At the encoding / decoding end, when it is determined that the current image will be filtered using TALF, filter coefficients and a filtering mode are determined. Based on the filtering mode and vector information corresponding to the current position, at least one reference position corresponding to the current position is determined. Filtering is performed based on the filtering mode, reconstructed samples from at least one reference position, and filter coefficients to determine the filtered reconstructed value at the current position. Therefore, this application proposes a temporal adaptive loop filtering method. During TALF filtering, the filtering mode can be combined with vector information including motion vectors or block vectors corresponding to the sample position to obtain the corresponding reference position. Simultaneously, the corresponding filtering mode performs TALF filtering on the sample position based on the reference position. For one or more filtering modes, weights can be introduced during the filtering process for weighting. That is, in this application, vector information is introduced to assist TALF filtering by combining the weights determined by the filtering mode, thereby further improving the filtering effect and enhancing encoding / decoding performance. Attached Figure Description
[0029] Figure 1 is a schematic diagram of the application of a coding framework provided by related technologies;
[0030] Figure 2 is a schematic diagram of the application of a loop filter module provided by related technologies;
[0031] Figure 3 is a schematic diagram of the shape of a common brightness adaptive loop filter;
[0032] Figure 4 is a schematic diagram of the shape of a common chromaticity adaptive loop filter.
[0033] Figure 5 is a schematic diagram of the loop filtering implementation process;
[0034] Figure 6 is a schematic diagram of the shape of the cross-component adaptive filter;
[0035] Figure 7 is a system block diagram of an encoder provided in an embodiment of this application;
[0036] Figure 8 is a system block diagram of a decoder provided in an embodiment of this application;
[0037] Figure 9 is a schematic diagram of the decoding method proposed in the embodiments of this application;
[0038] Figure 10 is a schematic diagram of the encoding method proposed in the embodiments of this application;
[0039] Figure 11 is a schematic diagram of the implementation of TALF filtering proposed in an embodiment of this application;
[0040] Figure 12 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application;
[0041] Figure 13 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application;
[0042] Figure 14 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application;
[0043] Figure 15 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application;
[0044] Figure 16 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application;
[0045] Figure 17 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application;
[0046] Figure 18 is a schematic diagram of the filtering position proposed in an embodiment of this application;
[0047] Figure 19 is a schematic diagram of the filtering position proposed in the embodiment of this application;
[0048] Figure 20 is a schematic diagram of the filtering position proposed in the embodiment of this application;
[0049] Figure 21 is a schematic diagram of the filtering position proposed in the embodiment of this application;
[0050] Figure 22 is a schematic diagram of the filtering position proposed in the embodiment of this application;
[0051] Figure 23 is a schematic diagram of the filtering position proposed in the embodiment of this application;
[0052] Figure 24 is a schematic diagram of the filter proposed in the embodiment of this application;
[0053] Figure 25 is a schematic diagram nine of the filter proposed in the embodiments of this application;
[0054] Figure 26 is a schematic diagram of the encoder structure proposed in the embodiment of this application;
[0055] Figure 27 is a schematic diagram of the specific hardware structure of the encoder proposed in the embodiment of this application;
[0056] Figure 28 is a schematic diagram of the composition structure of the decoder proposed in the embodiment of this application;
[0057] Figure 29 is a schematic diagram of the specific hardware structure of the decoder proposed in the embodiment of this application;
[0058] Figure 30 is a schematic diagram of the composition structure of the encoding and decoding system proposed in the embodiment of this application. Detailed Implementation
[0059] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining the relevant application and not for limiting the application. Furthermore, it should be noted that, for ease of description, only the parts relevant to the application are shown in the accompanying drawings.
[0060] In the following description, references to "some embodiments" refer to a subset of all possible embodiments. It is understood that "some embodiments" may be the same or different subsets of all possible embodiments and may be combined with each other without conflict. It should also be noted that the terms "first, second, third" used in the embodiments of this application are merely for distinguishing similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein.
[0061] 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.
[0062] In digital video encoding, the encoder reads unequal samples 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 data is then divided into blocks, and the block data is passed to the encoder for encoding.
[0063] Common video codec standards all employ a block-based hybrid coding framework. Each frame of a video image is divided into squares of equal size (e.g., 128×128, 64×64, etc.) called Largest Coding Units (LCUs) or Coding Tree Units (CTUs). Each LCU or CTU can be further divided into rectangular Coding Units (CUs) according to rules. Moreover, Coding Units may be further divided into smaller Prediction Units (PUs), Transform Units (TUs), etc.
[0064] Figure 1 is a schematic diagram of an application of a coding framework provided by related technologies. As shown in Figure 1, the hybrid coding framework may include a prediction module 11, a transform and quantization module 12, an entropy coding module 13, an inverse quantization and inverse transform module 14, a loop filtering module 15, and a decoding image buffer module 16. The prediction module 11 may include an intra-frame prediction module 11a and an inter-frame prediction module 11b. The inter-frame prediction module 11b may include a motion estimation module and a motion compensation module. Since there is a strong correlation between adjacent samples within a video image frame, using intra-frame prediction in video coding and decoding technology can eliminate spatial redundancy between adjacent samples. However, since there is also a strong similarity between adjacent frames in a video image, using inter-frame prediction in video coding and decoding technology can eliminate temporal redundancy between adjacent frames, thereby improving coding and decoding efficiency. The basic workflow of a video codec is as follows: At the encoding end, a frame is divided into blocks. Intra-frame prediction or inter-frame prediction is used on the coded blocks to generate prediction blocks. The original block of the coded block is subtracted from the prediction block to obtain a residual block. The residual block is transformed and quantized to obtain a quantization coefficient matrix. The quantization coefficient matrix is entropy-encoded and output to the bitstream. At the decoding end, intra-frame prediction or inter-frame prediction is used on the coded blocks to generate prediction blocks. On the other hand, the bitstream is decoded to obtain a quantization coefficient matrix. The quantization coefficient matrix is inverse-quantized and inverse-transformed to obtain a residual block. The prediction block and the residual block are added to obtain the reconstructed value. The reconstructed value forms the reconstructed image. Loop filtering is performed on the reconstructed image based on the image or based on the blocks to obtain the decoded image. The encoding end also needs similar operations to the decoding end to obtain the decoded image. The decoded image can be used as a reference frame for inter-frame prediction in subsequent frames. The block division information, prediction, transformation, quantization, entropy coding, loop filtering, and other mode information or parameter information determined at the encoding end need to be output to the bitstream if necessary. The decoding end determines the same block partitioning information, prediction, transform, quantization, entropy coding, loop filtering, and other mode or parameter information as the encoding end by parsing and analyzing existing information, thereby ensuring that the decoded image obtained by the encoding end is the same as that obtained by the decoding end. The decoded image obtained by the encoding end is usually also called the reconstructed image. During prediction, the coded block can be divided into prediction units, and during transform, the coded block can be divided into transform units. The division of prediction units and transform units can be different. The above is the basic flow of a video codec under a block-based hybrid coding framework. With the development of technology, some modules or steps of this framework or flow may be optimized. The embodiments of this application are applicable to the basic flow of a video codec under this block-based hybrid coding framework, but are not limited to this framework and flow.
[0065] Understandably, intra-frame prediction only references information from the same frame to predict sample information within the current block, thus eliminating spatial redundancy; inter-frame prediction can reference image information from different frames, using motion estimation to search for the motion vector information that best matches the current block, thus eliminating temporal redundancy; transform converts the predicted image block to the frequency domain, redistributing energy, and combined with quantization, removes information that is not sensitive to the human eye, thus eliminating visual redundancy; entropy coding can eliminate character redundancy based on the current context model and the probability information of the binary code stream; loop filtering mainly processes the samples after inverse transform and inverse quantization to compensate for distorted information and provide a better reference for subsequent encoded samples.
[0066] Loop filtering is prevalent in existing video coding standards, significantly improving the subjective and objective quality of reconstructed video. In VVC, loop filtering includes a deblocking filter (DBF), sample adaptive offset (SAO), adaptive loop filter (ALF), and cross component adaptive loop filter (CCALF). In the latest JVET Enhanced Compression Model (ECM), loop filtering further includes cross component sample adaptive offset (CCSAO) and bilateral filter (BIF). For example, Figure 2 shows an application diagram of a loop filtering module provided by related technologies. The block diagram of ECM loop filtering is shown in Figure 2.
[0067] The principle of adaptive loop filtering and cross-component adaptive loop filtering is to calculate one or more sets of filter coefficients based on the relationship between the reconstructed values and the original sample values. The filter coefficients are transmitted through the bitstream. After the decoder obtains the filter coefficients, it can construct a filter and use the filter to filter the reconstructed image, making the reconstructed image closer to the original image after filtering.
[0068] Adaptive loop filtering in VVC can be applied to both luminance and chrominance components. Figure 3 shows a schematic diagram of a common luminance adaptive loop filter, where the filter for the luminance component is a 7x7 diamond-shaped filter with symmetrical coefficients. Figure 4 shows a schematic diagram of a common chrominance adaptive loop filter, where the filter for the chrominance component is a 5x5 diamond-shaped filter with symmetrical coefficients.
[0069] In VVC, the adaptive loop filter for luminance and chrominance uses the reconstructed sample under the filter window as the input value. After multiplying with each coefficient of the adaptive filter and then summing them, a correction value for the center position of the filter is generated. The correction value is added to the reconstructed value at the center position to obtain the filtered value.
[0070] In ECM, adaptive loop filtering offers more refined processing. ECM's adaptive loop filtering has more coefficients, and the filter's input values are no longer limited to the current reconstructed value; they can also include residual values, reconstructed values before deblocking filtering, reconstructed values after deblocking filtering, reconstructed values after Gaussian filtering, and so on. The inputs to adaptive loop filtering in ECM have mostly undergone some pre-filtering, eliminating the need for the extensive transmission of adaptive coefficients through the bitstream as before.
[0071] For example, in VVC, the cross-component adaptive filtering is an 8-coefficient filter that applies only to the chroma component. Cross-component adaptive filtering uses the reconstructed luminance value as input to the filter, which, along with the filter coefficients, produces a correction value added to the chroma component to improve the subjective and objective quality of the chroma. In ECM, the number of filter coefficients is further increased to achieve higher filtering efficiency. Simultaneously, the luminance residual and the reconstructed chroma value are also used as inputs to the cross-component adaptive filter.
[0072] Figure 5 is a schematic diagram of the loop filtering process. As shown in Figure 5, CCALF can take the reconstructed brightness information and residual information (l0) as input. Therefore, CCALF takes the brightness reconstruction information and brightness residual information output by SAO as input, calculates the filter coefficients, performs filtering processing, and obtains the filtering result. or In addition, the chroma ALF itself also filters the chroma reconstruction information output by SAO, obtaining the corresponding filtered results. Finally, the filtered results of CCALF are... or The final chroma filtering result can be obtained by adding the filtering results of ALF and chroma.
[0073] Figure 6 is a schematic diagram of the cross-component adaptive filter shape. As shown in Figure 6, luminance information (luminance samples) can be used to minimize the error between the chroma reconstructed image and the original image, thereby completing the correction of the chroma samples.
[0074] In inter-frame mode and IBC mode, there are unidirectional and bidirectional prediction. Unidirectional prediction refers to the current coding block being pointed to by a single motion vector (MV) or block vector (BV) from a reference block in the reconstructed image or region. The predicted value of the current coding block is obtained from the reference bit block through motion compensation. Bidirectional prediction refers to the current coding block being pointed to by two separate MV / BV vectors from two reference blocks in the reconstructed image or region. The predicted value of the current coding block is obtained from the reference bit blocks through motion compensation and weighting.
[0075] In inter-frame coded frames, there are bidirectional prediction frames (B-frames) and unidirectional prediction frames (P-frames). In B-frames, there are both unidirectional and bidirectional predictions, and each B-frame has two reference image lists. In P-frames, there is only unidirectional prediction, and each P-frame has only one reference image list.
[0076] In VVC, the Bi-prediction with CU-level weight (BCW) technique allows an adaptive weight to weight two unidirectional motion-compensated prediction blocks to form bidirectional inter-frame predictions. The specific implementation is illustrated by the following formula: p bi =(p mv0 ×w0+p mv1 ×(8-w0)+4)>>3 (1)
[0077] Where, p bi It is the prediction of the current coded block after bidirectional weighting; p mv0 It is the predicted signal obtained after unidirectional MV0 motion compensation; p mv1 It is the predicted signal obtained after unidirectional MV1 motion compensation; w0 is the signal applied to p mv0 Weighting on.
[0078] All the selected MV or BV of the current block, the reference image index, and the weighting of the two bidirectional inter-frame predictions on the two unidirectional predictions can be stored in the motion buffer for use in subsequent inter-frame merging modes.
[0079] An adaptive parameter set (APS) is an image layer-level parameter set used to transmit adaptive parameters. The APS syntax element table in VVC is as follows:
[0080] The APS parameter set includes several syntax elements. `aps_adaptation_parameter_set_id` is used to assign an index to the currently decoded APS set, and `aps_params_type` indicates the type of the APS parameter set. In VVC, it can be a parameter set encoding ALF adaptive parameters, a parameter set for Luma Mapping with Chroma Scaling (LMCS) filters, or a SCALING parameter set. When the APS is an ALF type parameter set, it will further parse data such as the number of ALF filters and filter parameters.
[0081] Since common filtering techniques do not fully utilize the relevant information of the temporally reconstructed image, the filtering effect is not ideal, reducing encoding and decoding performance. To address this, this application proposes a TALF scheme that can fully utilize the relevant information of inter-frame reference images, thereby improving the filtering effect. Specifically, in this TALF scheme, vector information including motion vectors or block vectors corresponding to the sample position can be used to obtain the corresponding reference position, and TALF filtering of the sample position is performed based on the reference position; that is, vector information is introduced to assist TALF filtering.
[0082] Furthermore, embodiments of this application provide an encoding / decoding method, a bitstream, an encoder, a decoder, and a storage medium. In the process of TALF filtering assisted by vector signals, after obtaining the reference position using motion vectors or block vectors, corresponding weights are introduced for the reference position. A weighted calculation is then performed based on the reference position and the corresponding weights to complete the TALF filtering of the sample position. The introduction of weights and weighted processing can, on the one hand, provide filtering modes applicable to more filtering scenarios, and on the other hand, improve the accuracy of the TALF filtering input information, thereby further improving the filtering effect and enhancing encoding / decoding performance.
[0083] In other words, the encoding / decoding method proposed in this application, during the TALF filtering process, can combine filtering modes and use vector information including motion vectors or block vectors corresponding to the sample position to obtain the corresponding reference position. Simultaneously, the TALF filtering of the sample position is completed based on the reference position within the corresponding filtering mode. For one or more filtering modes, weights can be introduced for weighted averaging during the filtering process. That is, in this application, vector information is introduced to assist TALF filtering by combining the weights determined by the filtering mode, thereby further improving the filtering effect and enhancing encoding / decoding performance.
[0084] Referring to Figure 7, which shows an example of a system block diagram of an encoder provided in an embodiment of this application. As shown in Figure 7, the encoder 10 may include: a segmentation unit 101, a prediction unit 102, a first adder 107, a transform unit 108, a quantization unit 109, an inverse quantization unit 110, an inverse transform unit 111, a second adder 112, a filtering unit 113, a Decoded Picture Buffer (DPB) unit 114, and an entropy coding unit 115. Here, the input of the encoder 10 can be a video composed of a series of images or a single still image, and the output of the encoder 10 can be a bitstream (also called a "bitstream") representing a compressed version of the input video.
[0085] The segmentation unit 101 segments the images in the input video into one or more Coding Tree Units (CTUs). The segmentation unit 101 divides the image into multiple tiles, and can further divide a tile into one or more bricks. Here, a tile or a brick can include one or more complete and / or partial CTUs. Additionally, the segmentation unit 101 can form one or more slices, where a slice can include one or more tiles arranged in raster order in the image, or one or more tiles covering a rectangular area of the image. The segmentation unit 101 can also form one or more sub-images, where a sub-image can include one or more slices, tiles, or bricks.
[0086] During the encoding process of encoder 10, segmentation unit 101 transmits the CTU to prediction unit 102. Typically, prediction unit 102 may consist of block segmentation unit 103, motion estimation (ME) unit 104, motion compensation (MC) unit 105, and intra-prediction unit 106. Specifically, block segmentation unit 103 iteratively uses quadtree segmentation, binary tree segmentation, and ternary tree segmentation to further divide the input CTU into smaller coding units (CUs). Prediction unit 102 can use ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks of the CUs. Intra-prediction unit 106 can use various intra-prediction modes, including MIP modes, to obtain intra-frame prediction blocks of the CUs. In the example, rate-distortion optimized motion estimation can be invoked by ME unit 104 and MC unit 105 to obtain inter-frame prediction blocks, and rate-distortion optimized mode determination can be invoked by intra-prediction unit 106 to obtain intra-frame prediction blocks.
[0087] Prediction unit 102 outputs the predicted block of the CU. First adder 107 calculates the difference between the CU in the output of segmentation unit 101 and the predicted block of the CU, i.e., the residual CU. Transform unit 108 reads the residual CU and performs one or more transform operations on the residual CU to obtain coefficients. Quantization unit 109 quantizes the coefficients and outputs quantization coefficients (i.e., levels). Inverse quantization unit 110 performs a scaling operation on the quantization coefficients to output reconstructed coefficients. Inverse transform unit 111 performs one or more inverse transforms corresponding to the transforms in transform unit 108 and outputs the reconstructed residual. Second adder 112 calculates the reconstructed CU by adding the reconstructed residual to the predicted block of the CU from prediction unit 102. Second adder 112 also sends its output to prediction unit 102 as an intra-frame prediction reference. After all CUs in the image or sub-image are reconstructed, filtering unit 113 performs loop filtering on the reconstructed image or sub-image. Here, the filtering unit 113 includes one or more filters, such as a deblocking filter, a sample adaptive offset (SAO) filter, an adaptive loop filter (ALF), a luma mapping with chroma scaling (LMCS) filter, and a neural network-based filter. Alternatively, when the filtering unit 113 determines that the CU is not used as a reference for encoding other CUs, the filtering unit 113 performs loop filtering on one or more target samples in the CU.
[0088] The output of the filtering unit 113 is a decoded image or sub-image, which is buffered in the DPB unit 114. The DPB unit 114 outputs the decoded image or sub-image according to timing and control information. Here, the image stored in the DPB unit 114 can also be used as a reference for the prediction unit 102 to perform inter-frame prediction or intra-frame prediction. Finally, the entropy coding unit 115 converts the parameters (such as control parameters and supplementary information) necessary for decoding the image from the encoder 10 into binary form, and writes such binary form into the bitstream according to the syntax structure of each data unit, which is the final output bitstream of the encoder 10.
[0089] Furthermore, encoder 10 may be a first memory having a first processor and a computer program for recording. When the first processor reads and runs the computer program, encoder 10 reads the input video and generates a corresponding bitstream. Alternatively, encoder 10 may also be a computing device having one or more chips. These units, implemented as integrated circuits on the chips, have similar connection and data exchange functions to the corresponding units in Figure 7.
[0090] Referring to Figure 8, it shows an example of a system block diagram of a decoder provided in an embodiment of this application. As shown in Figure 8, the decoder 20 may include: a parsing unit 201, a prediction unit 202, an inverse quantization unit 205, an inverse transform unit 206, an adder 207, a filtering unit 208, and a decoded image buffer unit 209. Here, the input of the decoder 20 is a bitstream representing a compressed version of a video or a still image, and the output of the decoder 20 may be a decoded video composed of a series of images or a decoded still image.
[0091] The input bitstream to decoder 20 can be the bitstream generated by encoder 10. Parsing unit 201 parses the input bitstream and obtains the values of syntax elements from it. Parsing unit 201 converts the binary representation of the syntax elements into numerical values and sends these values to units in decoder 20 to obtain one or more decoded images. Parsing unit 201 can also parse one or more syntax elements from the input bitstream to display the decoded images.
[0092] During the decoding process of decoder 20, parsing unit 201 sends the value of the syntax element and one or more variables set or determined according to the value of the syntax element for obtaining one or more decoded images to the unit in decoder 20.
[0093] Prediction unit 202 determines the prediction block of the current decoded block (e.g., CU). Here, prediction unit 202 may include motion compensation unit 203 and intra-prediction unit 204. Specifically, when an inter-frame decoding mode is indicated for decoding the current decoded block, prediction unit 202 passes relevant parameters from parsing unit 201 to motion compensation unit 203 to obtain inter-frame prediction blocks; when an intra-frame prediction mode (including MIP mode indicated by MIP mode index value) is indicated for decoding the current decoded block, prediction unit 202 passes relevant parameters from parsing unit 201 to intra-prediction unit 204 to obtain intra-frame prediction blocks.
[0094] The dequantization unit 205 has the same function as the dequantization unit 110 in the encoder 10. The dequantization unit 205 performs a scaling operation on the quantization coefficients (i.e., levels) from the parsing unit 201 to obtain the reconstruction coefficients.
[0095] The inverse transform unit 206 has the same function as the inverse transform unit 111 in the encoder 10. The inverse transform unit 206 performs one or more transform operations (i.e., the inverse operation of one or more transform operations performed by the inverse transform unit 111 in the encoder 10) to obtain the reconstructed residual.
[0096] Adder 207 performs an addition operation on its inputs (the predicted block from prediction unit 202 and the reconstructed residual from inverse transform unit 206) to obtain the reconstructed block of the current decoded block. The reconstructed block is also sent to prediction unit 202 as a reference for other blocks encoded in intra-frame prediction mode.
[0097] After all CUs in an image or sub-image are reconstructed, filtering unit 208 performs loop filtering on the reconstructed image or sub-image. Filtering unit 208 includes one or more filters, such as deblocking filters, sampling adaptive compensation filters, adaptive loop filters, luminance mapping and chroma scaling filters, and neural network-based filters. Alternatively, when filtering unit 208 determines that a reconstructed block is not used as a reference for decoding other blocks, filtering unit 208 performs loop filtering on one or more target samples in the reconstructed block. Here, the output of filtering unit 208 is a decoded image or sub-image, which is buffered in DPB unit 209. DPB unit 209 outputs the decoded image or sub-image based on timing and control information. The image stored in DPB unit 209 can also be used as a reference for performing inter-frame prediction or intra-frame prediction by prediction unit 202.
[0098] Furthermore, decoder 20 can be a second memory having a second processor and a computer program for recording. When the first processor reads and runs the computer program, decoder 20 reads the input bitstream and generates the corresponding decoded video. Alternatively, decoder 20 can also be a computing device having one or more chips. These units, implemented as integrated circuits on the chips, have similar connection and data exchange functions to the corresponding units in Figure 8.
[0099] It should also be noted that when the embodiments of this application are applied to encoder 10, "encoding block" specifically refers to the block to be encoded in the video image (which can also be simply referred to as "encoding block"); when the embodiments of this application are applied to decoder 20, "encoding block" specifically refers to the block to be decoded in the video image (which can also be simply referred to as "decoding block").
[0100] Based on Figure 7, the encoding method in this embodiment is mainly applied to the "filtering unit 113" part of the encoder 10.
[0101] Based on Figure 8, the decoding method in this embodiment is mainly applied to the "filtering unit 208" part of the decoder 20.
[0102] In other words, the encoding and decoding methods in the embodiments of this application can be applied to a video encoding system (referred to as "encoder"), a video decoding system (referred to as "decoder"), or even to both a video encoding system and a video decoding system simultaneously, but no limitations are made here.
[0103] The technical solutions in the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings.
[0104] One embodiment of this application proposes a decoding method, which is applied to a decoder for performing filtering processing through a TALF filter. Figure 9 is a schematic diagram of the decoding method proposed in this application embodiment. As shown in Figure 9, the decoding method of the decoder may include the following steps:
[0105] Step 1001: If it is determined that the current image is filtered using TALF, determine the filter coefficients and the filtering mode.
[0106] In the embodiments of this application, if it is determined that the current image is filtered using TALF, the filter coefficients and filtering mode can be determined first.
[0107] It should be noted that, in the embodiments of this application, the first syntax element identification information can be determined by decoding the bitstream. This first syntax element identification information can be used to determine whether the current block in the current image is filtered using TALF; that is, based on the first syntax element identification information, it can be determined whether to use a TALF filter to filter the reconstructed values of the image components of the current block.
[0108] Furthermore, in embodiments of this application, for the TALF filter, the corresponding input information may include at least one inter-frame reference image corresponding to the current image, which may be a reconstructed image decoded in the temporal domain. The reconstructed sample values of at least one inter-frame reference image can be used to perform TALF filtering on the current block in the current image.
[0109] It is understood that in the embodiments of this application, the current block can be a CTU determined after dividing the current image, the current block can be a coding unit (CU) obtained after dividing the CTU, or the current block can be a sub-region of any size obtained after dividing the current image. This application does not specifically limit the size and acquisition method of the current block in the current image.
[0110] Furthermore, in the embodiments of this application, the first syntax element identification information can be used to determine whether to use TALF to filter the current block. The first syntax element identification information can be a flag, wherein if the current block is a CTU corresponding to the current image, then the first syntax element identification information can be a CTU-level flag; if the current block is a CU corresponding to the current image, then the first syntax element identification information can be a CU-level flag. Of course, corresponding to any size sub-region in the current image, the first syntax element identification information can also be a flag of other block levels. This application does not impose specific limitations.
[0111] Furthermore, in the embodiments of this application, the value of the first syntax element identifier information can be used to determine whether to use TALF filtering on the current block.
[0112] For example, in some embodiments, if the value of the first syntax element identifier information is a first value, it is determined that TALF filtering will not be used on the current block. If the value of the first syntax element identifier information is not a first value, it is determined that TALF filtering will be used on the current block.
[0113] It should be noted that, in the embodiments of this application, the first syntax element identification information can be used to indicate whether the current block uses TALF for filtering. Furthermore, the first value can be in parameter form or numeric form; no limitation is made here.
[0114] For example, in some embodiments, if the first syntax element identification information is a block-level flag, then in one specific example, the first value can be set to 0; in another specific example, the first value can also be set to false. The first value is not limited in any way in the embodiments of this application.
[0115] Taking a first value of 0 as an example, in this embodiment of the application, if the value of the first syntax element identifier information is 0, then it can be determined that the current block does not use TALF for filtering. Otherwise, if the value of the first syntax element identifier information is not 0, then it can be determined that the current block uses TALF for filtering.
[0116] For example, in some embodiments, if the current block of the current image is a CTU, then the first syntax element identification information can be CTU-level syntax. For instance, the first syntax element identification information can be represented by the syntax element control identifier talf_ctb_idc[CtbAddrX][CtbAddrY], that is, talf_ctb_idc[CtbAddrX][CtbAddrY] indicates whether to use TALF filtering on the current block of the current image. If the value of talf_ctb_idc[CtbAddrX][CtbAddrY] is 0, it is determined that TALF filtering is not used on the current block; if the value of talf_ctb_idc[CtbAddrX][CtbAddrY] is not 0, it is determined that TALF filtering is used on the current block. Of course, the value of talf_ctb_idc[CtbAddrX][CtbAddrY] is not limited to 0, and this application does not impose specific limitations.
[0117] Furthermore, in the embodiments of this application, the bitstream can be decoded first to determine the second syntax element identification information; if it is determined based on the second syntax element identification information that the current image is allowed to use TALF for filtering, the process of determining the first syntax element identification information is executed, that is, the process of parsing the first syntax element identification information is executed.
[0118] Furthermore, in embodiments of this application, the second syntax element identification information can be used to determine whether the current image is allowed to be filtered using TALF. The second syntax element identification information can be a flag.
[0119] It should be noted that, in the embodiments of this application, the second syntax element identification information can be an image-level flag, a slice-level (strip-level) flag, a sub-picture-level flag, or a tile-level flag. This application does not impose specific limitations.
[0120] For example, in some embodiments, if the second syntax element identification information is a slice-level flag, then the second syntax element identification information can be used to determine whether the current slice is allowed to use TALF for filtering.
[0121] Furthermore, in the embodiments of this application, the value of the second syntax element identifier information can be used to determine whether the current image (and / or the current slice) is allowed to use TALF for filtering.
[0122] For example, in some embodiments, if the value of the second syntax element identifier information is a second value, it is determined that the current image (and / or the current slice) is allowed to be filtered using TALF. If the value of the second syntax element identifier information is a third value, it is determined that the current image (and / or the current slice) is not filtered using TALF.
[0123] It should be noted that, in the embodiments of this application, the second syntax element identification information can be used to indicate whether the current image (and / or the current slice) is filtered using TALF. Furthermore, the second value and the third value are different, and the second and third values can be in parameter form or in numerical form. Typically, the second syntax element identification information can be a parameter written in the Slice header or picture header; no limitations are imposed here.
[0124] It should also be noted that if the second syntax element identifier is an image-level flag or a slice-level flag, then in one specific example, the second value can be set to 1 and the third value can be set to 0; in another specific example, the second value can also be set to true and the third value can also be set to false; even in yet another specific example, the second value can also be set to 0 and the third value can also be set to 1; or, the second value can also be set to false and the third value can also be set to true. The second and third values are not limited in any way in the embodiments of this application.
[0125] Assuming the second syntax element identifier is an image-level flag, with a second value of 1 and a third value of 0 as an example, in this embodiment, if the value of the second syntax element identifier is 1, it can be determined that the current image uses TALF filtering. Otherwise, if the value of the second syntax element identifier is 0, it can be determined that the current image does not use TALF filtering.
[0126] For example, in some embodiments, assuming the second syntax element identification information is an image-level flag, then the second syntax element identification information can be represented by the syntax element ph_talf_enabled_flag, that is, ph_talf_enabled_flag indicates whether the current image is allowed to use TALF filtering. If the value of ph_talf_enabled_flag is 0, it is determined that TALF filtering is not used on the current image; if the value of ph_talf_enabled_flag is 1, it is determined that TALF filtering is allowed on the current image.
[0127] For example, in some embodiments, assuming the second syntax element identification information is a slice-level flag, the second syntax element identification information can be represented by the syntax element sh_talf_enabled_flag, that is, sh_talf_enabled_flag indicates whether the current slice is allowed to use TALF filtering. If the value of sh_talf_enabled_flag is 0, it is determined that TALF filtering is not used for the current slice; if the value of sh_talf_enabled_flag is 1, it is determined that TALF filtering is allowed for the current slice.
[0128] Of course, the value of sh_talf_enabled_flag is not limited to 0 and 1, and this application does not impose specific restrictions.
[0129] Therefore, in the embodiments of this application, the parsing of the first syntax element identifier information may depend on the second syntax element identifier information. That is, the block-level identifier may depend on the image-level identifier, or the block-level identifier may depend on the slice-level identifier. For example, if it is determined that the current image (and / or the current slice) is filtered using TALF based on the second syntax element identifier information, the determination of the first syntax element identifier information can be further performed; otherwise, it is not necessary to decode the first syntax element identifier information.
[0130] For example, in some embodiments, the image-level TALF identifier (second syntax element identification information) and the corresponding APS index are encoded in the image header as follows:
[0131] Among them, ph_talf_enabled_flag is used to indicate whether the current image is filtered using TALF, and ph_talf_aps_id can be used to indicate which APS parameter set the adaptive parameters of TALF (such as the number of filters and filter coefficients) are obtained when using TALF.
[0132] Furthermore, in the embodiments of this application, the bitstream can be decoded first to determine the third syntax element identification information; if it is determined based on the third syntax element identification information that the current sequence is filtered using TALF, the process of determining the second syntax element identification information is executed.
[0133] Furthermore, in embodiments of this application, the third syntax element identification information can be used to determine whether to apply TALF filtering to the current sequence. The third syntax element identification information can be a flag, for example, a sequence-level flag.
[0134] Furthermore, in the embodiments of this application, the value of the third syntax element identifier information can be used to determine whether to use TALF filtering on the current sequence.
[0135] For example, in some embodiments, if the value of the third syntax element identifier information is a fourth value, it is determined that TALF filtering should be applied to the current sequence. If the value of the third syntax element identifier information is a fifth value, it is determined that TALF filtering should not be applied to the current sequence.
[0136] It should be noted that, in the embodiments of this application, the third syntax element identification information can be used to indicate whether the current sequence is filtered using TALF. Furthermore, the fourth and fifth values are different, and both can be in parameter form or numerical form; no limitation is made here.
[0137] It should also be noted that if the third syntax element identifier is a sequence-level flag, then in one specific example, the fourth value can be set to 1 and the fifth value can be set to 0; in another specific example, the fourth value can also be set to true and the fifth value can also be set to false; even in yet another specific example, the fourth value can also be set to 0 and the fifth value can also be set to 1; or, the fourth value can also be set to false and the fifth value can also be set to true. The fourth and fifth values are not limited in any way in the embodiments of this application.
[0138] Assuming the third syntax element identifier is a sequence-level flag, with the fourth value being 1 and the fifth value being 0, in this embodiment, if the value of the third syntax element identifier is 1, then it can be determined that the current sequence uses TALF filtering. Otherwise, if the value of the third syntax element identifier is 0, then it can be determined that the current sequence does not use TALF filtering.
[0139] For example, in some embodiments, assuming the third syntax element identification information is a sequence-level flag, the third syntax element identification information can be represented by the syntax element `sps_talf_enabled_flag`, that is, `sps_talf_enabled_flag` indicates whether to use TALF filtering on the current sequence. If the value of `sps_talf_enabled_flag` is 0, it is determined that TALF filtering is not used on the current sequence; if the value of `sps_talf_enabled_flag` is 1, it is determined that TALF filtering is used on the current sequence.
[0140] Of course, the value of sps_talf_enabled_flag is not limited to 0 and 1, and this application does not impose specific restrictions.
[0141] Therefore, in the embodiments of this application, the parsing of the second syntax element identifier information may depend on the third syntax element identifier information; that is, the image-level (and / or slice-level) identifier may depend on the sequence-level identifier. For example, if it is determined that the current sequence is to be filtered using TALF based on the third syntax element identifier information, the determination of the second syntax element identifier information can be further performed; otherwise, it is not necessary to decode the second syntax element identifier information.
[0142] In other words, in the embodiments of this application, TALF may include a sequence-level enable flag, i.e., third syntax element identification information. For example, the way to add a TALF sequence-level flag to standard text can be as follows:
[0143] Among them, sps_talf_enabled_flag is used to indicate whether the current sequence is filtered using TALF, and sps_alf_enabled_flag is used to indicate whether the current sequence is filtered using ALF.
[0144] Furthermore, in the embodiments of this application, the sequence-level TALF identifier may depend on the sequence-level ALF identifier, that is, the parsing of the third syntax element identifier information may be dependent on the parsing of the sequence-level syntax elements of ALF.
[0145] For example, in some embodiments, it is assumed that the sequence-level ALF flag can be represented by the syntax element `sps_alf_enabled_flag`, that is, `sps_alf_enabled_flag` indicates whether ALF filtering is applied to the current sequence. If `sps_alf_enabled_flag` indicates that ALF filtering is not applied to the current sequence, then the third syntax element flag information can be left undecoded; if `sps_alf_enabled_flag` indicates that ALF filtering is applied to the current sequence, then the determination of the third syntax element flag information can be further performed.
[0146] For example, in some embodiments, the TALF sequence-level identifier (third syntax element identifier information) may depend on the ALF image-level identifier (image-level ALF identifier), and the dependency relationship may be as follows:
[0147] Among them, sps_talf_enabled_flag is used to indicate whether the current sequence is filtered using TALF, and sps_alf_enabled_flag is used to indicate whether the current sequence is filtered using ALF. Only when the current sequence is allowed to use ALF, that is, when sps_alf_enabled_flag indicates that ALF is used to filter the current sequence, can sps_talf_enabled_flag be further parsed.
[0148] Furthermore, in embodiments of this application, the image-level (and / or slice-level) identifier depends on the sequence-level identifier, which may include the image-level (and / or slice-level) TALF identifier depending on the sequence-level TALF identifier, and may also include the image-level (and / or slice-level) TALF identifier depending on the sequence-level ALF identifier.
[0149] In other words, in the embodiments of this application, the parsing of the second syntax element identification information may depend on the third syntax element identification information or on the sequence-level ALF identifier.
[0150] For example, in some embodiments, it is assumed that the sequence-level ALF flag can be represented by the syntax element `sps_alf_enabled_flag`, that is, `sps_alf_enabled_flag` indicates whether ALF filtering is applied to the current sequence. If `sps_alf_enabled_flag` indicates that ALF filtering is not applied to the current sequence, then the second syntax element flag information can be left undecoded; if `sps_alf_enabled_flag` indicates that ALF filtering is applied to the current sequence, then the determination of the second syntax element flag information can be further performed.
[0151] For example, in some embodiments, the TALF image-level identifier (image-level TALF identifier) may depend on the ALF sequence-level identifier (sequence-level ALF identifier), and the dependency relationship may be as follows:
[0152] Among them, sps_talf_enabled_flag is used to indicate whether the current sequence uses TALF for filtering, sps_alf_enabled_flag is used to indicate whether the current sequence uses ALF for filtering, ph_talf_enabled_flag is used to indicate whether the current image uses TALF for filtering, and ph_talf_aps_id can be used to indicate which APS parameter set the adaptive parameters of TALF (such as the number of filters, filter coefficients) are obtained when using TALF.
[0153] Furthermore, in embodiments of this application, the image-level (and / or slice-level) TALF identifier may also depend on the image-level (and / or slice-level) ALF identifier.
[0154] In other words, in the embodiments of this application, the parsing of the second syntax element identification information can also rely on image-level (and / or slice-level) ALF identification.
[0155] For example, in some embodiments, it is assumed that the image-level ALF flag can be represented by the syntax element ph_alf_enabled_flag, that is, ph_alf_enabled_flag indicates whether the current image is allowed to be filtered using ALF. If ph_alf_enabled_flag indicates that the current image is not to be filtered using ALF, then the second syntax element flag information can be left undecoded; if ph_alf_enabled_flag indicates that the current image is allowed to be filtered using ALF, then the determination of the second syntax element flag information can be further performed.
[0156] For example, in some embodiments, the TALF image-level identifier (image-level TALF identifier) may depend on the ALF image-level identifier (image-level ALF identifier), and the dependency relationship may be as follows:
[0157] Among them, sps_talf_enabled_flag is used to indicate whether the current sequence is filtered using TALF, ph_alf_enabled_flag is used to indicate whether the current image is filtered using ALF, ph_talf_enabled_flag is used to indicate whether the current image is filtered using TALF, and ph_talf_aps_id can be used to indicate which APS parameter set the adaptive parameters of TALF (such as the number of filters, filter coefficients) are obtained when using TALF.
[0158] For example, in some embodiments, the image-level (and / or slice-level) TALF identifier may also rely on some high-level syntax, such as the high-level syntax element pps_alf_info_in_ph_flag to identify the image-level or slice-level control identifier that uses image-level or slice-level syntax elements to parse the ALF, and the ALF identifier may also exist in the slice header.
[0159] For example, in some embodiments, the TALF slice-level identifier (slice-level TALF identifier) may depend on the TALF control identifier, and the dependency relationship may be as follows:
[0160] Among them, sps_talf_enabled_flag is used to indicate whether the current sequence uses TALF for filtering, pps_alf_info_in_ph_flag is used to indicate whether to use image-level or slice-level syntax elements to parse ALF image-level or slice-level control flags, sh_talf_enabled_flag is used to indicate whether the current slice uses TALF for filtering, and sh_talf_aps_id can be used to indicate which APS parameter set the adaptive parameters of TALF (such as the number of filters, filter coefficients) are obtained when using TALF.
[0161] Furthermore, in the embodiments of this application, if it is determined that TALF will be used for filtering, then the filter coefficients can be further determined.
[0162] Furthermore, in the embodiments of this application, when determining the filter coefficients corresponding to the current block, the quantity parameter, coefficient value parameter, and coefficient sign parameter corresponding to the current block can be determined first; then the number of filter groups can be determined according to the quantity parameter; then the filter coefficients corresponding to the current block can be determined according to the number of filter groups, coefficient value parameter, coefficient sign parameter, and first syntax element identification information.
[0163] It is understood that, in the embodiments of this application, the quantity parameter can be used to determine the number of filter groups corresponding to the current image. The coefficient value parameter can be used to determine the absolute value of the filter coefficients. The coefficient sign parameter can be used to determine the sign of the filter coefficients, including positive and negative signs.
[0164] Furthermore, in the embodiments of this application, the number of filter groups can be determined based on a quantity parameter. Specifically, the number of filter groups can be determined based on the quantity parameter and a preset value.
[0165] It is understood that, in the embodiments of this application, when determining the number of filter groups based on the quantity parameter and the preset value, mathematical operations can be performed on the value of the quantity parameter and the preset value to calculate the number of filter groups.
[0166] For example, in some embodiments, the quantity parameter can be represented by the syntax element `talf_num_filters_signalled_minus1`, which indicates the number of TALF filters in the current slice minus 1 (i.e., a default value of 1). Assuming a slice can have a maximum of four TALF filters, the value of `talf_num_filters_signalled_minus1` can be 0, 1, 2, or 3. A syntax element of 0 indicates that the current slice has one TALF filter, 1 indicates that the current slice has two TALF filters, 2 indicates that the current slice has three TALF filters, and 3 indicates that the current slice has four TALF filters. When this syntax element is not present in the bitstream, its default value can be 0.
[0167] Furthermore, in the embodiments of this application, when determining the filter coefficients corresponding to the current block based on the number of filter groups, coefficient numerical parameters, coefficient sign parameters, and first syntax element identification information, the candidate filter corresponding to the current block can be determined first based on the first syntax element identification information and the number of filter groups; and then the filter coefficients corresponding to the current block can be determined based on the candidate filter corresponding to the current block, coefficient numerical parameters, and coefficient sign parameters.
[0168] It is understood that, in the embodiments of this application, the first syntax element identification information can also be used to determine the TALF information used by the current block. For example, the candidate filter corresponding to the current block can be determined by the value of the first syntax element identification information.
[0169] For example, in some embodiments, if the value of the first syntax element identifier information is a first value, it is determined that TALF filtering will not be used on the current block. If the value of the first syntax element identifier information is not a first value, it is determined that TALF filtering will be used on the current block, and the candidate filter corresponding to the current block can be further determined based on the first syntax element identifier information.
[0170] Furthermore, in the embodiments of this application, when determining the candidate filter corresponding to the current block based on the first syntax element identifier information and the number of filter groups, the number of filter groups corresponding to the current block can be determined first based on the first syntax element identifier information; then, the candidate filter corresponding to the current block can be determined based on the number of filter groups and the number of filter groups corresponding to the current block.
[0171] It is understood that, in the embodiments of this application, when it is determined that TALF filtering will be applied to the current block, the group index of the filter corresponding to the current block can be determined based on the value of the first syntax element identifier information. The group index of the filter can represent the index of the TALF filter used by the current block in the set of filters encoded and decoded in the current image; that is, the group index of the filter can be used to select the candidate filter corresponding to the current block from among multiple filters corresponding to the current image.
[0172] For example, in some embodiments, if the current block of the current image is a CTU, assuming the first syntax element identification information is represented by the syntax element control identifier talf_ctb_idc[CtbAddrX][CtbAddrY], if the value of talf_ctb_idc[CtbAddrX][CtbAddrY] is 0, it is determined that TALF filtering is not used on the current block; if the value of talf_ctb_idc[CtbAddrX][CtbAddrY] is 1, it can be determined that the candidate filter corresponding to the current block can be the first filter in at least one set of filters; if the value of talf_ctb_idc[CtbAddrX][CtbAddrY] is 2, it can be determined that the candidate filter corresponding to the current block can be the second filter in at least one set of filters.
[0173] It should be noted that, in the embodiments of this application, the value of the first syntax element identifier information depends on the number of filter groups. Assuming that the number of filter groups can be determined by the quantity parameter talf_num_filters_signalled_minus1, then the value of the first syntax element identifier information talf_ctb_idc[CtbAddrX][CtbAddrY] can depend on talf_num_filters_signalled_minus1. For example, the value range of talf_ctb_idc[CtbAddrX][CtbAddrY]-1 can be 0-talf_num_filters_signalled_minus1.
[0174] Furthermore, in the embodiments of this application, when determining the filter coefficients corresponding to the current block based on the candidate filter, coefficient numerical parameters, and coefficient sign parameters, the value of the filter coefficients corresponding to the candidate filter can be determined based on the coefficient numerical parameters; at the same time, the sign of the filter coefficients corresponding to the candidate filter can be determined based on the coefficient sign parameters; finally, the filter coefficients corresponding to the current block can be determined based on the value and sign of the filter coefficients corresponding to the candidate filter.
[0175] It is understood that, in the embodiments of this application, after determining the candidate filter corresponding to the current block based on the first syntax element identification information, the filter coefficients can be reconstructed by further combining the coefficient numerical parameters and coefficient sign parameters, thereby obtaining the filter coefficients corresponding to the current block.
[0176] For example, in some embodiments, the numerical parameter of the coefficient can be represented by the syntax element talf_coeff_abs[sfIdx][j], where talf_coeff_abs[sfIdx][j] can be used to determine the absolute value of the j-th coefficient of the sfIdx-th filter group. For example, talf_coeff_abs[sfIdx][j] can be represented using K-order exponential Golomb code, where K is 0.
[0177] It should be noted that, in the embodiments of this application, if the syntax element talf_coeff_abs[sfIdx][j] does not exist in the bitstream, its value can be defaulted to 0.
[0178] For example, in some embodiments, the coefficient sign parameter can be represented by the syntax element talf_coeff_sign[sfIdx][j], where talf_coeff_sign[sfIdx][j] can be used to determine the sign of the j-th coefficient of the sfIdx-th filter group. For example, a value of 1 for talf_coeff_sign[sfIdx][j] indicates that the j-th coefficient of the sfIdx-th filter group has a negative sign, and a value of 0 for talf_coeff_sign[sfIdx][j] indicates that the j-th coefficient of the sfIdx-th filter group has a positive sign.
[0179] It should be noted that, in the embodiments of this application, if the syntax element talf_coeff_sign[sfIdx][j] does not exist in the bitstream, its value can be defaulted to 0.
[0180] In other words, in the embodiments of this application, if the candidate filter determined based on the first syntax element identification information is the sfIdx group filter, the filter coefficients can be reconstructed by combining the coefficient numerical parameter talf_coeff_abs[sfIdx][j] and the coefficient sign parameter talf_coeff_sign[sfIdx][j].
[0181] For example, in some embodiments, based on the candidate filter corresponding to the current block, according to the absolute value of the filter coefficients and the filter...
[0182] The process of reconstructing filters with positive and negative coefficients is as follows:
[0183] The variable numCoeff represents the number of filter coefficients in the filter.
[0184] Furthermore, in the embodiments of this application, if it is determined that TALF will be used for filtering, the filtering mode can be further determined. The filtering mode can be used to determine the filtering input information; that is, the input information for TALF filtering can be different for different filtering modes.
[0185] For example, in some embodiments, the filtering mode may include at least one or more of the following: a first mode (e.g., mode 0), a second mode (e.g., mode 1), a third mode (e.g., mode 2), a fourth mode (e.g., mode 3), a fifth mode (e.g., mode 4), a sixth mode (e.g., mode 5), a seventh mode (e.g., mode 6), and an eighth mode (e.g., mode 7).
[0186] Furthermore, in the embodiments of this application, the bitstream can be decoded to determine the filtering mode corresponding to the current image (or current slice). For example, the bitstream can be decoded to determine the syntax elements indicating the filtering mode, thereby determining the corresponding filtering mode.
[0187] For example, in some embodiments, the filtering mode corresponding to the current image (or current slice) can be represented by the syntax element `talf_filter_mode`. The value range of `talf_filter_mode` can depend on the value of the syntax element `talf_reuse_flag`, which indicates whether to reuse historical filters. For instance, when `talf_reuse_flag` is 0, i.e., when historical filters are not reused, the value range of `talf_filter_mode` is 0, 1, 2, 3, 4, or 5, respectively indicating the first mode, second mode, third mode, fourth mode, fifth mode, or sixth mode; when `talf_reuse_flag` is 1, i.e., when historical filters are reused, the value range of `talf_filter_mode` is 0, 1, 2, 3, 4, 5, 6, or 7, respectively indicating the first mode, second mode, third mode, fourth mode, fifth mode, sixth mode, seventh mode, or eighth mode.
[0188] Furthermore, in the embodiments of this application, vector information corresponding to the current position in the current image can be selected to assist TALF filtering. Specifically, during the process of using vector information corresponding to the current position to assist TALF filtering, the position corresponding to the current position can be offset based on the vector information corresponding to the current position, thereby obtaining at least one reference position corresponding to the current position.
[0189] It is understood that in the embodiments of this application, the images in which at least one reference position is determined are different for different types of vector information. For example, for a motion vector, the determined at least one reference position is in the inter-frame reference image pointed to by the motion vector; for a block vector, the determined at least one reference position is in the current image.
[0190] It should be noted that, in the embodiments of this application, when using vector information to assist TALF filtering, the selected vector information can be different for different filtering modes.
[0191] Step 1002: Determine at least one reference position corresponding to the current position based on the filtering mode and the vector information corresponding to the current position.
[0192] In the embodiments of this application, after determining the filtering mode, at least one reference position corresponding to the current position can be determined based on the filtering mode and the vector information corresponding to the current position.
[0193] It should be noted that, in the embodiments of this application, vector information may include motion vectors (MV) and block vectors (BV). The methods for determining at least one corresponding reference position differ depending on the type of vector information.
[0194] It is understood that in the embodiments of this application, the loop filtering stage is performed on the reconstructed image after the current image has been reconstructed. Therefore, when performing temporal loop filtering, it can already be determined whether the coding block at the current position has selected intra-prediction, inter-prediction, or IBC prediction. For example, in the ECM reference software, if the block to which the current position belongs is an intra-prediction block, and the intraTMP prediction mode is selected, there will be one or more saved BVs in the motion buffer; if the IBC prediction mode is selected, there will also be one or more saved BVs in the motion buffer; if the inter-prediction mode is selected, there will be one or more saved MVs in the motion buffer.
[0195] Furthermore, in the embodiments of this application, if the vector information corresponding to the current position includes at least one motion vector corresponding to the current position, then when determining at least one reference position corresponding to the current position based on the filtering mode and the vector information corresponding to the current position, at least one inter-frame reference image corresponding to the current image can be determined first based on the filtering mode and at least one motion vector; then, if at least one inter-frame reference image exists in the list of reference images corresponding to the current image, at least one reference position corresponding to the current position can be determined in at least one inter-frame reference image based on at least one motion vector.
[0196] Furthermore, in the embodiments of this application, when determining at least one reference position corresponding to the current position in at least one inter-frame reference image based on a filtering mode and at least one motion vector, if the filtering mode satisfies a first condition, a first position offset value in a first direction and a second position offset value in a second direction are determined according to the first motion vector; and a first reference position is determined in the first inter-frame reference image according to the first position offset value and the second position offset value.
[0197] For example, in some embodiments, the first condition includes at least one or more of the following: the filtering mode is a first mode; the filtering mode is a third mode and only the first motion vector exists; the filtering mode is a fourth mode and only the first motion vector exists.
[0198] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 0, then the filtering mode can be determined to be the first mode. At this time, there is a motion vector corresponding to the current position, namely the first motion vector MV0.
[0199] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 2, then the filtering mode can be determined to be the third mode. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0200] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 3, then the filtering mode can be determined to be the fourth mode. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0201] In other words, in the embodiments of this application, the first condition may include, but is not limited to: the value of the syntax element talf_filter_mode is 0, or the value of the syntax element talf_filter_mode is 2 and only MV0 points to rec0, or the value of the syntax element talf_filter_mode is 3 and only MV0 points to rec0.
[0202] It should be noted that, in the embodiments of this application, the first offset value is used for position offset in the first direction, and the second offset value is used for position offset in the second direction. The first direction and the second direction can be the horizontal direction and the vertical direction, respectively.
[0203] Accordingly, in the embodiments of this application, for a filtering mode that satisfies the first condition, a first position offset value in the first direction and a second position offset value in the second direction can be determined first based on the first motion vector; then, a first reference position can be determined in the first inter-frame reference image based on the first position offset value and the second position offset value.
[0204] It is understood that, in the embodiments of this application, the first reference position is the sample position in the first inter-frame reference image that corresponds to the current position and is offset based on the motion vector.
[0205] Furthermore, in the embodiments of this application, when determining at least one reference position corresponding to the current position in at least one inter-frame reference image based on a filtering mode and at least one motion vector, if the filtering mode satisfies the second condition, a third position offset value in the first direction and a fourth position offset value in the second direction can be determined based on the second motion vector; and a second reference position can be determined in the second inter-frame reference image based on the third position offset value and the fourth position offset value.
[0206] For example, in some embodiments, the second condition includes at least one or more of the following: the filtering mode is a second mode; the filtering mode is a third mode and only the second motion vector exists; the filtering mode is a fourth mode and only the second motion vector exists.
[0207] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 1, then the filtering mode can be determined to be the second mode. At this time, there is a motion vector corresponding to the current position, namely the second motion vector MV1.
[0208] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 2, then the filtering mode can be determined to be the third mode. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0209] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 3, then the filtering mode can be determined to be the fourth mode. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0210] In other words, in the embodiments of this application, the second condition may include, but is not limited to: the value of the syntax element talf_filter_mode is 1, or the value of the syntax element talf_filter_mode is 2 and only MV1 points to rec1, or the value of the syntax element talf_filter_mode is 3 and only MV1 points to rec1.
[0211] It should be noted that, in the embodiments of this application, the third offset value is used for position offset in the first direction, and the fourth offset value is used for position offset in the second direction. The first direction and the second direction can be the horizontal direction and the vertical direction, respectively.
[0212] Accordingly, in the embodiments of this application, for a filtering mode that satisfies the second condition, the third position offset value in the first direction and the fourth position offset value in the second direction can be determined first based on the second motion vector; then, the second reference position can be determined in the second inter-frame reference image based on the third position offset value and the fourth position offset value.
[0213] It is understood that, in the embodiments of this application, the second reference position is the sample position in the second inter-frame reference image that corresponds to the current position and is offset based on the motion vector.
[0214] Furthermore, in the embodiments of this application, when determining at least one reference position corresponding to the current position in at least one inter-frame reference image based on a filtering mode and at least one motion vector, if the filtering mode satisfies a third condition, a first position offset value in a first direction and a second position offset value in a second direction can be determined based on the first motion vector; a third position offset value in the first direction and a fourth position offset value in the second direction can be determined based on the second motion vector; a first reference position can be determined in the first inter-frame reference image based on the first position offset value and the second position offset value; and a second reference position can be determined in the second inter-frame reference image based on the third position offset value and the fourth position offset value.
[0215] For example, in some embodiments, the third condition includes at least one or more of the following: the filtering mode is a third mode, and there is a first motion vector and a second motion vector; the filtering mode is a fourth mode, and there is a first motion vector and a second motion vector; the filtering mode is a fifth mode; the filtering mode is a sixth mode; the filtering mode is a seventh mode; the filtering mode is an eighth mode.
[0216] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 2 or 3, then the filtering mode can be determined as the third mode or the fourth mode respectively. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0217] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 4, 5, 6 or 7, then the filtering mode can be determined as the fifth mode, the sixth mode, the seventh mode or the eighth mode respectively. At this time, the current position can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0218] In other words, in the embodiments of this application, the third condition may include, but is not limited to: the value of the syntax element talf_filter_mode is 2 and MV0 points to rec0 and MV1 points to rec1 at the same time; or, the value of the syntax element talf_filter_mode is 3 and MV0 points to rec0 and MV1 points to rec1 at the same time; or, the value of the syntax element talf_filter_mode is 4, 5, 6 or 7.
[0219] It should be noted that, in the embodiments of this application, the first offset value and the third offset value are used for position offset in the first direction, and the second offset value and the fourth offset value are used for position offset in the second direction. The first direction and the second direction can be the horizontal direction and the vertical direction, respectively.
[0220] Accordingly, in the embodiments of this application, for a filtering mode that satisfies the third condition, a first position offset value in the first direction and a second position offset value in the second direction can be determined based on the first motion vector; at the same time, a third position offset value in the first direction and a fourth position offset value in the second direction can be determined based on the second motion vector; then, a first reference position can be determined in the first inter-frame reference image based on the first position offset value and the second position offset value, and a second reference position can be determined in the second inter-frame reference image based on the third position offset value and the fourth position offset value.
[0221] It is understood that in the embodiments of this application, the first reference position is the sample position in the first inter-frame reference image that corresponds to the current position and is offset based on the motion vector, and the second reference position is the sample position in the second inter-frame reference image that corresponds to the current position and is offset based on the motion vector.
[0222] Furthermore, in the embodiments of this application, after determining at least one inter-frame reference image corresponding to the current image based on at least one motion vector, if there is no at least one inter-frame reference image in the list of reference images corresponding to the current image, the TALF filtering for the current position can be skipped.
[0223] For example, in some embodiments, the filtering mode corresponding to the current image is represented as talf_filter_mode. When determining at least one corresponding reference position, if talf_filter_mode is 0, it is confirmed whether the prediction block to which the current position belongs selects MV0 pointing to the reference image in reference image list 0. If selected, the reference image rec0 pointed to by MV0 is used as input; otherwise, the filtering at the current position is skipped. If talf_filter_mode is 1, it is confirmed whether the prediction block to which the current position belongs selects MV1 pointing to the reference image in reference image list 1. If selected, the reference image rec1 pointed to by MV1 is used as input; otherwise, the filtering at the current position is skipped. The method of skipping the TALF filtering at the current position can also be applied to other filtering modes.
[0224] Furthermore, in the embodiments of this application, if the vector information corresponding to the current position includes at least one block vector corresponding to the current position, when determining at least one reference position corresponding to the current position based on the filtering mode and the vector information corresponding to the current position, at least one reference position corresponding to the current position can be directly determined in the current image based on the filtering mode and at least one block vector.
[0225] It should be noted that, in the embodiments of this application, the method of block vector-assisted TALF filtering is the same as the method of motion vector-assisted TALF filtering, and this application does not impose any specific limitations.
[0226] Furthermore, in embodiments of this application, an identifier can be introduced to further control whether vector information is used to assist TALF filtering. For example, auxiliary filtering identifier information can be transmitted in the bitstream, which is used to determine whether vector information is used to assist TALF filtering.
[0227] Furthermore, in the embodiments of this application, the bitstream can be decoded to determine the auxiliary filter identification information; if it is determined that vector information is used to assist TALF filtering based on the auxiliary filter identification information, the process of determining at least one reference position is executed, that is, the scheme of step 1002 is executed.
[0228] Furthermore, in embodiments of this application, the auxiliary filter identification information can be used to determine whether the current position is allowed to use vector information to assist TALF filtering. The auxiliary filter identification information can be a flag.
[0229] It should be noted that, in the embodiments of this application, the auxiliary filter identification information can be an image-level flag, a slice-level (strip-level) flag, a sub-picture-level flag, or a tile-level flag. This application does not impose any specific limitations.
[0230] Furthermore, in the embodiments of this application, the value of the auxiliary filter identifier information can be used to determine whether vector information is allowed to assist TALF filtering.
[0231] For example, in some embodiments, when the value of the auxiliary filter identifier information is 0, it is determined that vector information is not used to assist TALF filtering. When the value of the auxiliary filter identifier information is 1, it is determined that vector information is used to assist TALF filtering.
[0232] For example, in some embodiments, if the auxiliary filter identifier information is set to false, it is determined that vector information will not be used to assist TALF filtering. If the auxiliary filter identifier information is set to true, it is determined that vector information will be used to assist TALF filtering.
[0233] It should be noted that, in the embodiments of this application, the value of the auxiliary filter identifier information can be in parameter form or in numerical form. Typically, the auxiliary filter identifier information can be a parameter written in the Slice header or picture header, and no limitation is made here.
[0234] Assuming the auxiliary filter flag is an image-level flag, if the value of the auxiliary filter flag is 1, then it can be determined that the current image allows the use of vector information to assist TALF filtering. Otherwise, if the value of the auxiliary filter flag is 0, then it can be determined that the current image does not allow the use of vector information to assist TALF filtering.
[0235] For example, in some embodiments, the auxiliary filtering identification information can be represented by the syntax element `talf_mv_guided_flag`, that is, `talf_mv_guided_flag` indicates whether the current position is allowed to use vector information to assist TALF filtering. If the value of `talf_mv_guided_flag` is 0, it is determined that the current position is not allowed to use vector information to assist TALF filtering; if the value of `talf_mv_guided_flag` is 1, it is determined that the current position is allowed to use vector information to assist TALF filtering.
[0236] Of course, the value of talf_mv_guided_flag is not limited to 0 and 1, and this application does not impose specific restrictions.
[0237] For example, one implementation is that the parsed slice-level syntax elements need to include an additional identifier indicating whether a TALF is used with MV assistance. The parsed slice-level syntax elements are as follows:
[0238] The `talf_mv_guided_flag` flag indicates whether the TALF in the current chip is based on motion vectors or block vectors for filtering. When the flag is 1, the temporal adaptive loop filtering of the current chip is based on motion vectors and block vectors (vector information); when the flag is 0, the temporal adaptive loop filtering of the current chip is not based on motion vectors and block vectors (vector information). If this syntax element does not exist in the bitstream, its default value of 0 can be used.
[0239] Furthermore, in the embodiments of this application, after determining the auxiliary filter identification information, if it is determined based on the auxiliary filter identification information that vector information is not used to assist TALF filtering, at least one co-position corresponding to the current position is determined in at least one inter-frame reference image corresponding to the current image; filtering is performed based on the reconstructed samples and filter coefficients of at least one co-position to determine the filtered reconstructed value of the current position.
[0240] It is understood that, in the embodiments of this application, if it is determined that vector information is not used to assist TALF filtering, then at least one inter-frame reference image and filter coefficients corresponding to the current image can be determined according to the conventional TALF filtering method, and then TALF filtering can be performed based on at least one inter-frame reference image and filter coefficients.
[0241] In other words, in the embodiments of this application, if the vector information corresponding to the current position in the current image is not used to assist TALF filtering, then at least one inter-frame reference image corresponding to the current image can be further determined.
[0242] Therefore, in the embodiments of this application, the methods for determining the reference image can be different for different scenarios, such as using vector information corresponding to the current position to assist TALF filtering and not using vector information corresponding to the current position to assist TALF filtering, and the final determined reference image can also be different.
[0243] For example, in some embodiments, if vector information is not used to assist TALF filtering, then according to the conventional TALF filtering process, the input image of the determined filter can be an inter-frame reference image, and then filtering can be performed based on the reconstructed samples in at least one inter-frame reference image; if vector information is used to assist TALF filtering, the input image of the determined filter can be an inter-frame reference image or the current image itself, and then filtering can be performed based on the reconstructed samples in at least one inter-frame reference image, or based on the reconstructed samples in the current image.
[0244] Furthermore, in the embodiments of this application, if talf_mv_guided_flag is 0, that is, vector information is not used to assist TALF filtering, Offset0X (first offset value), Offset0Y (second offset value), Offset1X (third offset value) and Offset1Y (fourth offset value) can also be set to 0.
[0245] Furthermore, in the embodiments of this application, if vector information is not used to assist TALF filtering, then according to the conventional TALF filtering process, when determining at least one inter-frame reference image corresponding to the current image and the filter coefficients corresponding to the current block, the TALF parameters corresponding to the current block can be determined first; wherein, the TALF parameters include one or more of mode parameters, quantity parameters, coefficient value parameters, and coefficient sign parameters; then the filtering mode and the number of filter groups are determined according to the TALF parameters; at least one inter-frame reference image can be determined according to the filtering mode; at the same time, the filter coefficients corresponding to the current block can be determined according to the number of filter groups, coefficient value parameters, coefficient sign parameters, and the first syntax element identification information.
[0246] It is understood that, in the embodiments of this application, the mode parameter can be used to determine the filtering mode of the TALF filter, wherein, for different filtering modes, the inter-frame reference image corresponding to the current image can be different. The quantity parameter can be used to determine the number of filter groups corresponding to the current image. The coefficient value parameter can be used to determine the absolute value of the filter coefficients. The coefficient sign parameter can be used to determine the sign of the filter coefficients, including positive and negative signs.
[0247] Furthermore, in the embodiments of this application, when determining the TALF parameters corresponding to the current block, the bitstream can be decoded and the APS index can be determined if the current image is determined to be filtered using TALF based on the second syntax element identification information; then the APS set can be determined based on the APS index, and the TALF parameters can be determined based on the APS set.
[0248] It is understood that, in the embodiments of this application, the APS index can be used to determine the APS parameter set corresponding to the current image, that is, the APS set corresponding to the current image can be determined through the APS index.
[0249] For example, in some embodiments, when it is determined that the current image is filtered using TALF based on the second syntax element identification information, the bitstream can be further decoded to determine the corresponding APS index ph_talf_aps_id. The ph_talf_aps_id can be used to indicate in which APS parameter set the adaptive parameters (TALF parameters) of the current image are obtained when using TALF.
[0250] For example, in some embodiments, when it is determined that the current slice uses TALF for filtering based on the second syntax element identification information, the bitstream can be further decoded to determine the corresponding APS index sh_talf_aps_id. The sh_talf_aps_id can be used to indicate in which APS parameter set the adaptive parameters (TALF parameters) of the current slice are obtained when using TALF.
[0251] In other words, in the embodiments of this application, the TALF parameters corresponding to the current image can be stored in the APS, so that the TALF parameters can be obtained by parsing in the APS.
[0252] Step 1003: Filter based on the filtering mode, reconstructed samples at at least one reference position and filter coefficients to determine the filtered reconstructed value at the current position.
[0253] In the embodiments of this application, after determining at least one reference position corresponding to the current position based on the filtering mode and the vector information corresponding to the current position, filtering can be further performed based on the filtering mode, the reconstructed samples of at least one reference position and the filter coefficients, so as to determine the filtered reconstructed value of the current position.
[0254] It is understood that, in the embodiments of this application, the filtering process of using vector information to assist TALF filtering can also be understood as reconstructing the image (inter-frame reference image or current image) and filtering coefficients based on the obtained position offset (first position offset value and second position offset value) and filtering the (x, y) position (current position).
[0255] Furthermore, in the embodiments of this application, when filtering is performed based on the filtering mode, the reconstructed sample at at least one reference position and the filter coefficients to determine the filtered reconstructed value at the current position, if the filtering mode satisfies the first condition, the reconstructed sample value at the current position and the reconstructed sample value at the first reference position are determined; and the filtered reconstructed value at the current position is determined according to the filter coefficients, the reconstructed sample value at the current position and the reconstructed sample value at the first reference position.
[0256] In other words, in the embodiments of this application, for a filtering mode that satisfies the first condition, after determining the first position offset value in the first direction and the second position offset value in the second direction based on the first motion vector, and determining the first reference position in the first inter-frame reference image based on the first position offset value and the second position offset value, the reconstructed sample value of the first reference position can be used to filter the current position in combination with the reconstructed sample value and the filter coefficients, thereby determining the filtered reconstructed value of the current position.
[0257] For example, if the syntax element talf_filter_mode is 0, it means that the current slice will use mode 0 (the first mode), and a one-way filter with an offset indicated by MV0 pointing to the reference image list 0 can be used.
[0258] For example, in some embodiments, if the syntax element talf_filter_mode is 2, it means that the current slice will use mode 2 (the third mode), which uses MV0 to find the offset position in reference image 0 for one-way filtering when only MV0 pointing to reference image list 0 exists.
[0259] For example, in some embodiments, if the syntax element talf_filter_mode is 3, it means that the current slice will use mode 3 (the fourth mode), which uses MV0 to find the offset position in reference image 0 for one-way filtering when only MV0 pointing to reference image list 0 exists.
[0260] Furthermore, in the embodiments of this application, when filtering is performed based on the filtering mode, the reconstructed sample at at least one reference position, and the filter coefficients to determine the filtered reconstructed value at the current position, if the filtering mode satisfies the second condition, the reconstructed sample value at the current position and the reconstructed sample value at the second reference position are determined; and the filtered reconstructed value at the current position is determined according to the filter coefficients, the reconstructed sample value at the current position, and the reconstructed sample value at the second reference position.
[0261] In other words, in the embodiments of this application, for a filtering mode that satisfies the second condition, after determining the third position offset value in the first direction and the fourth position offset value in the second direction based on the second motion vector, and determining the second reference position in the second inter-frame reference image based on the third position offset value and the fourth position offset value, the reconstructed sample value of the second reference position can be used to filter the current position in combination with the reconstructed sample value and the filter coefficients, thereby determining the filtered reconstructed value of the current position.
[0262] For example, if the syntax element talf_filter_mode is 1, it means that the current slice will use mode 1 (second mode), and a one-way filter with an offset indicated by MV1 pointing to the reference image list 1 can be used.
[0263] For example, in some embodiments, if the syntax element talf_filter_mode is 2, it means that the current slice will use mode 2 (the third mode), which uses MV1 to find the offset position in reference image 1 for one-way filtering when only MV1 pointing to reference image list 1 exists.
[0264] For example, in some embodiments, if the syntax element talf_filter_mode is 3, it means that the current slice will use mode 3 (the fourth mode), which uses MV1 to find the offset position in reference image 1 for one-way filtering when only MV1 pointing to reference image list 1 exists.
[0265] Furthermore, in the embodiments of this application, for the filtering mode that satisfies the third condition, the filtering process under different filtering modes can be different. Specifically, for different filtering modes, whether to use weights, the filtering input information, and the weight values when using weights can be different.
[0266] Furthermore, in the embodiments of this application, when filtering based on the filtering mode, reconstructed samples at at least one reference position, and filter coefficients to determine the filtered reconstructed value at the current position, for a filtering mode that satisfies the third condition, if the filtering mode is the third mode, or the fourth mode, or the sixth mode, or the eighth mode, the first weight corresponding to the first reference position and the second weight corresponding to the second reference position are determined according to the filtering mode; the filtered reconstructed value at the current position is determined by filtering based on the reconstructed samples at the first reference position, the first weight, the reconstructed samples at the second reference position, the second weight, and the filter coefficients.
[0267] In other words, in the embodiments of this application, if the value of the syntax element talf_filter_mode is 2 and MV0 points to rec0 and MV1 points to rec1 at the same time, or if the value of the syntax element talf_filter_mode is 3 and MV0 points to rec0 and MV1 points to rec1 at the same time, or if the value of the syntax element talf_filter_mode is 5 or 7, then weights need to be introduced for weighting during the filtering process. Therefore, the corresponding weights can be determined for different reference positions first, that is, the first weight corresponding to the first reference position and the second weight corresponding to the second reference position can be determined.
[0268] It should be noted that, in the embodiments of this application, when determining the weight values, a preset value can be used to assign the first weight and the second weight proportionally, or the weighted weight of the already cached inter-frame prediction can be directly referenced to assign the first weight and the second weight. Of course, other assignment methods can also be used to assign the first weight and the second weight, and this application does not impose any specific limitations.
[0269] Furthermore, in the embodiments of this application, the selection of weight values for weighting during the filtering process can introduce two new unidirectional predictions: one is to use a 1:1 weighting ratio when MV0 and MV1 exist, and the other is to use the weighting of inter-frame prediction.
[0270] Furthermore, in the embodiments of this application, weight values are selected to be introduced for weighted processing during the filtering process, which can introduce two new bidirectional predictions: applying inter-frame prediction weights to the original bidirectional prediction and the bidirectional prediction with swapped inputs.
[0271] It is understood that, in the embodiments of this application, the methods for determining weight values may be different for different filtering modes.
[0272] For example, in some embodiments, when determining the first weight corresponding to the first reference position and the second weight corresponding to the second reference position according to the filtering mode, if the filtering mode is a third mode, the first weight and the second weight are set to preset values. The preset values can be non-zero integers, for example, the preset value can be 1.
[0273] In other words, in the embodiments of this application, for the third mode, a preset value can be selected to assign proportional weights to the first weight and the second weight. For example, if the syntax element talf_filter_mode has a value of 2 and both MV0 and MV1 point to rec1, proportional weights can be used to determine the weights corresponding to the two reference positions.
[0274] For example, in some embodiments, when determining the first weight corresponding to the first reference position and the second weight corresponding to the second reference position according to the filtering mode, if the filtering mode is the fourth mode, the sixth mode, or the eighth mode, the first inter-frame prediction weight corresponding to the first reference position and the second inter-frame prediction weight corresponding to the second reference position are determined; the first weight is determined according to the first inter-frame prediction weight, and the second weight is determined according to the second inter-frame prediction weight.
[0275] In other words, in the embodiments of this application, for the fourth mode, or the sixth mode, or the eighth mode, the weighted weights of the already cached inter-frame prediction can be used to assign weights. That is, the first weight corresponding to the first reference position is determined using the first inter-frame prediction weights corresponding to the first reference position, and the second weight corresponding to the second reference position is determined using the second inter-frame prediction weights corresponding to the second reference position. For example, the syntax element talf_filter_mode has a value of 3 and both MV0 and MV1 point to rec1, or the syntax element talf_filter_mode has a value of 5 or 7, and the weights corresponding to the two reference positions are determined using the weighted weights of the inter-frame prediction.
[0276] Furthermore, in the embodiments of this application, when filtering based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the first weight, the reconstructed sample value at the second reference position, the second weight, and the filter coefficients to determine the filtered reconstructed value at the current position, in the case of the filtering mode being the third mode or the fourth mode, the reconstructed sample value at the first reference position, the reconstructed sample value at the second reference position, the first weight, and the second weight are weighted to determine the weighted sample value; and the reconstructed sample value at the current position is determined by filtering based on the reconstructed sample value at the current position, the weighted sample value, and the filter coefficients.
[0277] In other words, in the embodiments of this application, for the filtering process that introduces weights for weighted processing, if the filtering mode is the third mode or the fourth mode, the reconstructed sample value of the first reference position and the reconstructed sample value of the second reference position can be weighted using the first weight and the second weight to obtain a weighted sample value; then the weighted sample value is used for unidirectional filtering, that is, filtering is performed based on the reconstructed sample value of the current position, the weighted sample value and the filter coefficients to determine the filtered reconstructed value of the current position.
[0278] For example, in some embodiments, if the syntax element talf_filter_mode is 2, it means that the current slice will use mode 2 (third mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and uses equal weights to weight the reconstructed pixels at the two reference positions to obtain a weighted signal, and performs unidirectional filtering.
[0279] For example, in some embodiments, if the syntax element talf_filter_mode is 3, it means that the current slice will use mode 3 (fourth mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and uses the weighted weight of inter-frame prediction to weight the reconstructed pixels at the two reference positions to obtain the weighted signal, and performs unidirectional filtering.
[0280] Furthermore, in the embodiments of this application, when filtering based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the first weight, the reconstructed sample value at the second reference position, the second weight, and the filter coefficients to determine the filtered reconstructed value at the current position, in the case of the sixth filtering mode, the weighted sample value corresponding to the first reference position is determined based on the reconstructed sample value at the first reference position and the first weight, and the weighted sample value corresponding to the second reference position is determined based on the reconstructed sample value at the second reference position and the second weight; the filtered reconstructed value at the current position is determined by filtering based on the reconstructed sample value at the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position, and the filter coefficients.
[0281] In other words, in the embodiments of this application, for the filtering process that introduces weights for weighted processing, if the filtering mode is the sixth mode, the reconstructed sample value at the first reference position can be weighted using the first weight, and the reconstructed sample value at the second reference position can be weighted using the second weight to obtain two weighted sample values, namely, the weighted sample value corresponding to the first reference position and the weighted sample value corresponding to the second reference position; then, these two weighted sample values are used for bidirectional filtering, that is, filtering is performed based on the reconstructed sample value at the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position, and the filter coefficients to determine the filtered reconstructed value at the current position.
[0282] For example, in some embodiments, if the syntax element talf_filter_mode is 5, it means that the current slice will use mode 5 (sixth mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1. The reconstructed signals at the two reference positions are respectively weighted by inter-frame bidirectional prediction and used as the input of the two filters of bidirectional filtering for bidirectional filtering.
[0283] Furthermore, in the embodiments of this application, when filtering based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the first weight, the reconstructed sample value at the second reference position, the second weight, and the filter coefficients to determine the filtered reconstructed value at the current position, in the case of the eighth filtering mode, the weighted sample value corresponding to the second reference position is determined based on the reconstructed sample value at the first reference position and the first weight, and the weighted sample value corresponding to the first reference position is determined based on the reconstructed sample value at the second reference position and the second weight; the filtered reconstructed value at the current position is determined by filtering based on the reconstructed sample value at the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position, and the filter coefficients.
[0284] In other words, in the embodiments of this application, for the filtering process that introduces weights for weighted processing, if the filtering mode is the eighth mode, the first weight can be used to weight the reconstructed sample value at the first reference position, and the second weight can be used to weight the reconstructed sample value at the second reference position to obtain two weighted sample values, that is, the weighted sample value corresponding to the first reference position and the weighted sample value corresponding to the second reference position are obtained; then the input positions of the two sample values are swapped, and bidirectional filtering is performed, that is, filtering is performed based on the reconstructed sample value at the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position, and the filter coefficients to determine the filtered reconstructed value at the current position.
[0285] For example, in some embodiments, if the syntax element talf_filter_mode is 7, it means that the current slice will use mode 7 (eighth mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1. After applying the weights of inter-frame bidirectional prediction to the reconstructed signals at the two reference positions and swapping the input positions, it uses them as the input of the two filters for bidirectional filtering.
[0286] Furthermore, in the embodiments of this application, when filtering based on the filtering mode, the reconstructed samples at at least one reference position, and the filter coefficients to determine the filtered reconstructed value at the current position, for the filtering mode that satisfies the third condition, if the filtering mode is the fifth mode or the seventh mode, the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, and the reconstructed sample value at the second reference position are determined; the filtered reconstructed value at the current position is determined by filtering based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the reconstructed sample value at the second reference position, and the filter coefficients.
[0287] In other words, in the embodiments of this application, for the fifth mode or the seventh mode, weights can be omitted during the filtering process. Instead, after determining the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, and the reconstructed sample value at the second reference position, filtering is performed based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the reconstructed sample value at the second reference position, and the filter coefficients to finally determine the filtered reconstructed value at the current position.
[0288] For example, in some embodiments, if the syntax element talf_filter_mode is 4, it means that the current slice will use mode 4 (the fifth mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and uses the reconstructed signals at the two reference positions as inputs to the two filters of bidirectional filtering to perform bidirectional filtering.
[0289] For example, in some embodiments, if the syntax element talf_filter_mode is 6, it means that the current slice will use mode 6 (seventh mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and swaps the input positions of the reconstructed signals at the two reference positions as the input of the two filters for bidirectional filtering.
[0290] Furthermore, in embodiments of this application, if it is determined that vector information is not used to assist TALF filtering, then filtering can be performed based on reconstructed samples and filter coefficients of at least one inter-frame reference image to determine the filtered reconstructed value at the current position.
[0291] It should be noted that, in the embodiments of this application, after determining that the current block is filtered using TALF based on the first syntax element identification information, and determining at least one inter-frame reference image corresponding to the current image and the filter coefficients corresponding to the current block, the current block can be further filtered based on the reconstructed samples of at least one inter-frame reference image and the filter coefficients corresponding to the current block to determine the filtered reconstructed value of the current block.
[0292] Furthermore, in the embodiments of this application, when determining the filtered reconstructed sample value of the current sample position based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, and the reconstructed sample value of the reference sample position, a first sample difference can be determined based on the reconstructed sample value of the current sample position and the reconstructed sample value of the reference sample position; and then the filtered reconstructed sample value of the current sample position can be determined based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, and the first sample difference.
[0293] In other words, in the embodiments of this application, it is also possible to first determine the first sample difference based on the reconstructed sample value at the current sample position and the reconstructed sample value at the reference sample position, and then use the first sample difference as the input of the filter.
[0294] Furthermore, in the embodiments of this application, when determining the filtered reconstructed sample value of the current sample position based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, and the reconstructed sample value of the reference sample position, the filtering position corresponding to the reference sample position can be determined in the current block, and the reconstructed sample value of the filtering position can be determined based on the reconstructed value of the current block; the second sample difference can be determined based on the reconstructed sample value of the filtering position and the reconstructed sample value of the reference sample position; and the filtered reconstructed sample value of the current sample position can be determined based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, and the second sample difference.
[0295] In other words, in the embodiments of this application, it is also possible to select, for each filtering position, a second sample difference value is determined based on the reconstructed sample value of the filtering position and the reconstructed sample value of the reference sample position, and then the second sample difference value is used as the input of the filter.
[0296] Further, in the embodiments of this application, when filtering the current block based on the reconstructed samples of at least one inter-frame reference image and the filter coefficients corresponding to the current block to determine the filtered reconstructed value of the current block, for the current sample position in the current block, the reconstructed sample value of the current sample position is determined according to the reconstructed value of the current block; the reconstructed sample value of the first reference sample position corresponding to the current sample position is determined according to the reconstructed samples of the first inter-frame reference image; the reconstructed sample value of the second reference sample position corresponding to the current sample position is determined according to the reconstructed samples of the second inter-frame reference image; the filtered reconstructed sample value of the current sample position is determined according to the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the reconstructed sample value of the first reference sample position, and the reconstructed sample value of the second reference sample position; and the filtered reconstructed value of the current block is determined according to the filtered reconstructed sample value of the current sample position.
[0297] Furthermore, in the embodiments of this application, when determining the filtered reconstructed sample value of the current sample position based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the reconstructed sample value of the first reference sample position, and the reconstructed sample value of the second reference sample position, a third sample difference can be determined based on the reconstructed sample value of the current sample position and the reconstructed sample value of the first reference sample position; a fourth sample difference can be determined based on the reconstructed sample value of the current sample position and the reconstructed sample value of the second reference sample position; and the filtered reconstructed sample value of the current sample position can be determined based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the third sample difference, and the fourth sample difference.
[0298] In other words, in the embodiments of this application, it is also possible to first determine the third sample difference and the fourth sample difference based on the reconstructed sample value at the current sample position and the reconstructed sample values at the two reference sample positions, and then use the third sample difference and the fourth sample difference as the input of the filter.
[0299] Furthermore, in the embodiments of this application, when determining the filtered reconstructed sample value of the current sample position based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the reconstructed sample value of the first reference sample position, and the reconstructed sample value of the second reference sample position, the filtering position corresponding to the reference sample position can be determined in the current block, and the reconstructed sample value of the filtering position can be determined based on the reconstructed value of the current block; the fifth sample difference can be determined based on the reconstructed sample value of the filtering position and the reconstructed sample value of the first reference sample position; the sixth sample difference can be determined based on the reconstructed sample value of the filtering position and the reconstructed sample value of the second reference sample position; and the filtered reconstructed sample value of the current sample position can be determined based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the fifth sample difference, and the sixth sample difference.
[0300] In other words, in the embodiments of this application, it is also possible to select, for each filtering position, to determine the fifth sample difference and the sixth sample difference based on the reconstructed sample value of the filtering position and the reconstructed sample values of the two reference sample positions respectively, and then use the fifth sample difference and the sixth sample difference as the input of the filter.
[0301] It should be noted that, in the embodiments of this application, the filter coefficients can be integers, and the parameters used in the filtering process may also include bias and shift.
[0302] Furthermore, in the embodiments of this application, the reconstructed value of the current block can be either the reconstructed value of the luminance component of the current block or the reconstructed value of the chrominance component of the current block; this application does not impose any specific limitation.
[0303] In other words, in the embodiments of this application, TALF filtering can be applied to any image component of the current image.
[0304] It should be noted that, in the embodiments of this application, the image components of the current image in the video image may include a first image component, a second image component, and a third image component. These three image components are respectively a luminance component, a blue color component, and a red color component. Specifically, the luminance component is typically represented by the symbol Y, the blue color component is typically represented by the symbol Cb or U, and the red color component is typically represented by the symbol Cr or V; thus, the video image can be represented in YCbCr format or YUV format.
[0305] Furthermore, in the embodiments of this application, the shape, size, and number of taps of the filter used in the TALF filtering process are not specifically limited; that is, filters of any shape and size can be applied to TALF filtering. For example, the shapes of filters used in the TALF filtering process include, but are not limited to, diamond-shaped, cross-shaped, rectangular, and square.
[0306] It is understood that the decoding method proposed in this application embodiment can use TALF for either the luminance component or the chrominance component.
[0307] It is understood that in the decoding method proposed in this application, the TALF switch identifier can be at any level. For example, the TALF can be switched on by image as a unit, or by CTU as a unit, or by CU as a unit, or by other methods of dividing the image into sub-regions.
[0308] It is understood that the decoding method proposed in this application embodiment may also choose to skip the encoding and decoding process of the CTU identifier and directly decide whether to perform TALF filtering on the entire image based on the image-level identifier. In this case, the current image corresponds to only one candidate filter.
[0309] In the encoding and decoding method proposed in the embodiments of this application, the methods of imparting equal weights to unidirectional or bidirectional filtering and imparting bidirectional prediction weights to unidirectional or bidirectional filtering can correspond to the filtering modes when talf_filter_mode is 2, 3, 4, 5, 6, and 7, respectively.
[0310] It is understood that in the embodiments of this application, the value of talf_filter_mode is not limited to 0-7. For example, talf_filter_mode can be 0, 1, 2, 3, 4, 5, which corresponds to 6 filtering modes. For these 6 filtering modes, the weighted one-way or two-way filtering proposed in this application can also be used. This application does not make any specific limitations.
[0311] Furthermore, in the embodiments of this application, since there is only one reference image list and only one-way prediction can be used for a frame during unidirectional inter-frame prediction (P-frame), the temporal adaptive loop filter should only have talf_filter_mode 0 during P-frame, and other modes are not applicable to P-frame. Therefore, when the current slice uses temporal adaptive loop filtering during P-frame, the value of talf_filter_mode does not need to be parsed, but its default value is directly zero.
[0312] Accordingly, in the embodiments of this application, parsing talf_filter_mode can be based on the current inter-frame coded slice being a B-slice.
[0313] For example, in some embodiments, a variable can be used to indicate whether it is a B-slice, such as isInterBSlice, that is, isInterBSlice can be a variable for determining whether the current slice is a bidirectional prediction slice.
[0314] In other words, in the embodiments of this application, the parsing of the syntax element talf_filter_mode can depend on the value of the variable isInterBSlice.
[0315] Furthermore, in the embodiments of this application, temporal adaptive loop filtering is a technique implemented on inter-frame coded frames, so it can be chosen not to use temporal adaptive loop filtering for intra-frame coded frames. Accordingly, a variable can be used to indicate whether it is a non-intra-coded slice, for example, isIntraSlice, that is, isIntraSlice can be a variable to determine whether the current slice is a non-intra-coded slice.
[0316] In other words, in the embodiments of this application, the parsing of the syntax element sh_talf_enabled_flag can depend on the value of the variable isIntraSlice.
[0317] For example, in some embodiments, the title sequence syntax elements are parsed as follows:
[0318] Among them, isIntraSlice is a variable used to determine whether the current slice is an intra-coded slice, and isInterBSlice is a variable used to determine whether the current slice is a bidirectional prediction slice.
[0319] Therefore, the encoding / decoding method proposed in the embodiments of this application can use equal weighting or inter-frame prediction weighting to weight the input values of the two reference positions at the bidirectional inter-frame prediction positions, and use them as inputs for unidirectional temporal adaptive loop filtering. Alternatively, equal weighting or inter-frame prediction weighting can be used to assign weights to the two inputs of the bidirectional adaptive loop filtering, and then implement bidirectional adaptive loop filtering.
[0320] In other words, the encoding / decoding method proposed in this application, during the process of TALF filtering assisted by vector information, can further introduce corresponding weights for the reference positions after obtaining the reference positions using motion vectors or block vectors, and perform weighted calculations based on the reference positions and corresponding weights to complete the TALF filtering of the sample positions. The introduction of weights and weighted processing can, on the one hand, provide filtering modes applicable to more filtering scenarios, and on the other hand, improve the accuracy of the TALF filtering input information, thereby further improving the filtering effect and enhancing encoding / decoding performance.
[0321] This application provides a decoding method. During TALF filtering, a reference position can be obtained by combining filtering modes and using vector information, including motion vectors or block vectors, corresponding to the sample position. Simultaneously, TALF filtering of the sample position is performed based on the reference position within the corresponding filtering mode. For one or more filtering modes, weights can be introduced during the filtering process for weighted averaging. In other words, this application introduces vector information to assist TALF filtering by combining the weights determined by the filtering mode, thereby further improving the filtering effect and enhancing encoding / decoding performance.
[0322] One embodiment of this application proposes an encoding method applied to an encoder for use in scenarios where filtering is performed by a TALF filter. Figure 10 is a schematic diagram of the encoding method proposed in this application. As shown in Figure 10, the method for the encoder to perform encoding processing may include the following steps:
[0323] Step 2001: If it is determined that the current image is filtered using TALF, determine the filter coefficients and the filtering mode.
[0324] In the embodiments of this application, if it is determined that the current image is filtered using TALF, the filter coefficients and filtering mode can be determined first.
[0325] Furthermore, in the embodiments of this application, each candidate mode can be traversed, and in each candidate mode, the candidate filter corresponding to the current block can be determined, and the filter coefficients corresponding to the current block can be determined based on the candidate filter corresponding to the current block.
[0326] It is understood that, in the embodiments of this application, each filtering mode (candidate mode) can be traversed, and the Wienerhof equation can be constructed using the current image reconstruction value under the corresponding mode, the reconstruction value of the reconstructed image (inter-frame reference image), and the original value of the current image, and 1 to 4 sets of filter coefficients can be parsed out. Specifically, for each set of candidate filters that may be used in the current block, the filter coefficients corresponding to that candidate filter can be derived; that is, the filter coefficients corresponding to the current block may include the filter coefficients of each set of candidate filters.
[0327] Furthermore, in the embodiments of this application, if it is determined that TALF will be used for filtering, the filtering mode can be further determined. The filtering mode can be used to determine the filtering input information; that is, the input information for TALF filtering can be different for different filtering modes.
[0328] For example, in some embodiments, the filtering mode may include at least one or more of the following: a first mode (e.g., mode 0), a second mode (e.g., mode 1), a third mode (e.g., mode 2), a fourth mode (e.g., mode 3), a fifth mode (e.g., mode 4), a sixth mode (e.g., mode 5), a seventh mode (e.g., mode 6), and an eighth mode (e.g., mode 7).
[0329] Furthermore, in the embodiments of this application, the filtering mode corresponding to the current image (or current slice) can be determined according to the rate-distortion optimization algorithm. Then, a syntax element indicating the filtering mode can be further set, and the syntax element can be written into the bitstream and transmitted to the decoding end.
[0330] For example, in some embodiments, the filtering mode corresponding to the current image (or current slice) can be represented by the syntax element `talf_filter_mode`. The value range of `talf_filter_mode` can depend on the value of the syntax element `talf_reuse_flag`, which indicates whether to reuse historical filters. For instance, when `talf_reuse_flag` is 0, i.e., when historical filters are not reused, the value range of `talf_filter_mode` is 0, 1, 2, 3, 4, or 5, respectively indicating the first mode, second mode, third mode, fourth mode, fifth mode, or sixth mode; when `talf_reuse_flag` is 1, i.e., when historical filters are reused, the value range of `talf_filter_mode` is 0, 1, 2, 3, 4, 5, 6, or 7, respectively indicating the first mode, second mode, third mode, fourth mode, fifth mode, sixth mode, seventh mode, or eighth mode.
[0331] Furthermore, in the embodiments of this application, vector information corresponding to the current position in the current image can be selected to assist TALF filtering. Specifically, during the process of using vector information corresponding to the current position to assist TALF filtering, the position corresponding to the current position can be offset based on the vector information corresponding to the current position, thereby obtaining at least one reference position corresponding to the current position.
[0332] It is understood that in the embodiments of this application, the images in which at least one reference position is determined are different for different types of vector information. For example, for a motion vector, the determined at least one reference position is in the inter-frame reference image pointed to by the motion vector; for a block vector, the determined at least one reference position is in the current image.
[0333] It should be noted that, in the embodiments of this application, when using vector information to assist TALF filtering, the selected vector information can be different for different filtering modes.
[0334] Step 2002: Determine at least one reference position corresponding to the current position based on the filtering mode and the vector information corresponding to the current position.
[0335] In the embodiments of this application, after determining the filtering mode, at least one reference position corresponding to the current position can be determined based on the filtering mode and the vector information corresponding to the current position.
[0336] It should be noted that, in the embodiments of this application, vector information may include motion vectors (MV) and block vectors (BV). The methods for determining at least one corresponding reference position differ depending on the type of vector information.
[0337] It is understood that in the embodiments of this application, the loop filtering stage is performed on the reconstructed image after the current image has been reconstructed. Therefore, when performing temporal loop filtering, it can already be determined whether the coding block at the current position has selected intra-prediction, inter-prediction, or IBC prediction. For example, in the ECM reference software, if the block to which the current position belongs is an intra-prediction block, and the intraTMP prediction mode is selected, there will be one or more saved BVs in the motion buffer; if the IBC prediction mode is selected, there will also be one or more saved BVs in the motion buffer; if the inter-prediction mode is selected, there will be one or more saved MVs in the motion buffer.
[0338] Furthermore, in the embodiments of this application, if the vector information corresponding to the current position includes at least one motion vector corresponding to the current position, then when determining at least one reference position corresponding to the current position based on the filtering mode and the vector information corresponding to the current position, at least one inter-frame reference image corresponding to the current image can be determined first based on the filtering mode and at least one motion vector; then, if at least one inter-frame reference image exists in the list of reference images corresponding to the current image, at least one reference position corresponding to the current position can be determined in at least one inter-frame reference image based on at least one motion vector.
[0339] Furthermore, in the embodiments of this application, when determining at least one reference position corresponding to the current position in at least one inter-frame reference image based on a filtering mode and at least one motion vector, if the filtering mode satisfies a first condition, a first position offset value in a first direction and a second position offset value in a second direction are determined according to the first motion vector; and a first reference position is determined in the first inter-frame reference image according to the first position offset value and the second position offset value.
[0340] For example, in some embodiments, the first condition includes at least one or more of the following: the filtering mode is a first mode; the filtering mode is a third mode and only the first motion vector exists; the filtering mode is a fourth mode and only the first motion vector exists.
[0341] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 0, then the filtering mode can be determined to be the first mode. At this time, there is a motion vector corresponding to the current position, namely the first motion vector MV0.
[0342] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 2, then the filtering mode can be determined to be the third mode. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0343] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 3, then the filtering mode can be determined to be the fourth mode. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0344] In other words, in the embodiments of this application, the first condition may include, but is not limited to: the value of the syntax element talf_filter_mode is 0, or the value of the syntax element talf_filter_mode is 2 and only MV0 points to rec0, or the value of the syntax element talf_filter_mode is 3 and only MV0 points to rec0.
[0345] It should be noted that, in the embodiments of this application, the first offset value is used for position offset in the first direction, and the second offset value is used for position offset in the second direction. The first direction and the second direction can be the horizontal direction and the vertical direction, respectively.
[0346] Accordingly, in the embodiments of this application, for a filtering mode that satisfies the first condition, a first position offset value in the first direction and a second position offset value in the second direction can be determined first based on the first motion vector; then, a first reference position can be determined in the first inter-frame reference image based on the first position offset value and the second position offset value.
[0347] It is understood that, in the embodiments of this application, the first reference position is the sample position in the first inter-frame reference image that corresponds to the current position and is offset based on the motion vector.
[0348] Furthermore, in the embodiments of this application, when determining at least one reference position corresponding to the current position in at least one inter-frame reference image based on a filtering mode and at least one motion vector, if the filtering mode satisfies the second condition, a third position offset value in the first direction and a fourth position offset value in the second direction can be determined based on the second motion vector; and a second reference position can be determined in the second inter-frame reference image based on the third position offset value and the fourth position offset value.
[0349] For example, in some embodiments, the second condition includes at least one or more of the following: the filtering mode is a second mode; the filtering mode is a third mode and only the second motion vector exists; the filtering mode is a fourth mode and only the second motion vector exists.
[0350] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 1, then the filtering mode can be determined to be the second mode. At this time, there is a motion vector corresponding to the current position, namely the second motion vector MV1.
[0351] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 2, then the filtering mode can be determined to be the third mode. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0352] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 3, then the filtering mode can be determined to be the fourth mode. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0353] In other words, in the embodiments of this application, the second condition may include, but is not limited to: the value of the syntax element talf_filter_mode is 1, or the value of the syntax element talf_filter_mode is 2 and only MV1 points to rec1, or the value of the syntax element talf_filter_mode is 3 and only MV1 points to rec1.
[0354] It should be noted that, in the embodiments of this application, the third offset value is used for position offset in the first direction, and the fourth offset value is used for position offset in the second direction. The first direction and the second direction can be the horizontal direction and the vertical direction, respectively.
[0355] Accordingly, in the embodiments of this application, for a filtering mode that satisfies the second condition, the third position offset value in the first direction and the fourth position offset value in the second direction can be determined first based on the second motion vector; then, the second reference position can be determined in the second inter-frame reference image based on the third position offset value and the fourth position offset value.
[0356] It is understood that, in the embodiments of this application, the second reference position is the sample position in the second inter-frame reference image that corresponds to the current position and is offset based on the motion vector.
[0357] Furthermore, in the embodiments of this application, when determining at least one reference position corresponding to the current position in at least one inter-frame reference image based on a filtering mode and at least one motion vector, if the filtering mode satisfies a third condition, a first position offset value in a first direction and a second position offset value in a second direction can be determined based on the first motion vector; a third position offset value in the first direction and a fourth position offset value in the second direction can be determined based on the second motion vector; a first reference position can be determined in the first inter-frame reference image based on the first position offset value and the second position offset value; and a second reference position can be determined in the second inter-frame reference image based on the third position offset value and the fourth position offset value.
[0358] For example, in some embodiments, the third condition includes at least one or more of the following: the filtering mode is a third mode, and there is a first motion vector and a second motion vector; the filtering mode is a fourth mode, and there is a first motion vector and a second motion vector; the filtering mode is a fifth mode; the filtering mode is a sixth mode; the filtering mode is a seventh mode; the filtering mode is an eighth mode.
[0359] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 2 or 3, then the filtering mode can be determined as the third mode or the fourth mode respectively. At this time, the current position can correspond to one motion vector, namely the first motion vector MV0 or the second motion vector MV1, or it can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0360] It is understood that in the embodiments of this application, if the value of the syntax element talf_filter_mode is 4, 5, 6 or 7, then the filtering mode can be determined as the fifth mode, the sixth mode, the seventh mode or the eighth mode respectively. At this time, the current position can correspond to two motion vectors, namely the first motion vector MV0 and the second motion vector MV1.
[0361] In other words, in the embodiments of this application, the third condition may include, but is not limited to: the value of the syntax element talf_filter_mode is 2 and MV0 points to rec0 and MV1 points to rec1 at the same time; or, the value of the syntax element talf_filter_mode is 3 and MV0 points to rec0 and MV1 points to rec1 at the same time; or, the value of the syntax element talf_filter_mode is 4, 5, 6 or 7.
[0362] It should be noted that, in the embodiments of this application, the first offset value and the third offset value are used for position offset in the first direction, and the second offset value and the fourth offset value are used for position offset in the second direction. The first direction and the second direction can be the horizontal direction and the vertical direction, respectively.
[0363] Accordingly, in the embodiments of this application, for a filtering mode that satisfies the third condition, a first position offset value in the first direction and a second position offset value in the second direction can be determined based on the first motion vector; at the same time, a third position offset value in the first direction and a fourth position offset value in the second direction can be determined based on the second motion vector; then, a first reference position can be determined in the first inter-frame reference image based on the first position offset value and the second position offset value, and a second reference position can be determined in the second inter-frame reference image based on the third position offset value and the fourth position offset value.
[0364] It is understood that in the embodiments of this application, the first reference position is the sample position in the first inter-frame reference image that corresponds to the current position and is offset based on the motion vector, and the second reference position is the sample position in the second inter-frame reference image that corresponds to the current position and is offset based on the motion vector.
[0365] Furthermore, in the embodiments of this application, after determining at least one inter-frame reference image corresponding to the current image based on at least one motion vector, if there is no at least one inter-frame reference image in the list of reference images corresponding to the current image, the TALF filtering for the current position can be skipped.
[0366] For example, in some embodiments, the filtering mode corresponding to the current image is represented as talf_filter_mode. When determining at least one corresponding reference position, if talf_filter_mode is 0, it is confirmed whether the prediction block to which the current position belongs selects MV0 pointing to the reference image in reference image list 0. If selected, the reference image rec0 pointed to by MV0 is used as input; otherwise, the filtering at the current position is skipped. If talf_filter_mode is 1, it is confirmed whether the prediction block to which the current position belongs selects MV1 pointing to the reference image in reference image list 1. If selected, the reference image rec1 pointed to by MV1 is used as input; otherwise, the filtering at the current position is skipped. The method of skipping the TALF filtering at the current position can also be applied to other filtering modes.
[0367] Furthermore, in the embodiments of this application, if the vector information corresponding to the current position includes at least one block vector corresponding to the current position, when determining at least one reference position corresponding to the current position based on the filtering mode and the vector information corresponding to the current position, at least one reference position corresponding to the current position can be directly determined in the current image based on the filtering mode and at least one block vector.
[0368] It should be noted that, in the embodiments of this application, the method of block vector-assisted TALF filtering is the same as the method of motion vector-assisted TALF filtering, and this application does not impose any specific limitations.
[0369] Furthermore, in embodiments of this application, an identifier can be introduced to further control whether vector information is used to assist TALF filtering. For example, auxiliary filtering identifier information can be transmitted in the bitstream, which is used to determine whether vector information is used to assist TALF filtering.
[0370] Furthermore, in the embodiments of this application, the cost of using vector information to assist TALF filtering and the cost of not using vector information to assist TALF filtering are determined; based on the cost of using vector information to assist TALF filtering and the cost of not using vector information to assist TALF filtering, auxiliary filtering identification information is determined and written into the bitstream; wherein, the auxiliary filtering identification information is used to determine whether to use vector information to assist TALF filtering.
[0371] Furthermore, in the embodiments of this application, when determining the auxiliary filtering identification information based on the cost of using vector information to assist TALF filtering and the cost of not using vector information to assist TALF filtering, if the cost of using vector information to assist TALF filtering is greater than or equal to the cost of not using vector information to assist TALF filtering, the auxiliary filtering identification information is set to indicate that vector information is not used for TALF filtering; if the cost of using vector information to assist TALF filtering is less than the cost of not using vector information to assist TALF filtering, the auxiliary filtering identification information is set to indicate that vector information is used for TALF filtering.
[0372] Furthermore, in embodiments of this application, the auxiliary filter identification information can be used to determine whether the current position is allowed to use vector information to assist TALF filtering. The auxiliary filter identification information can be a flag.
[0373] It should be noted that, in the embodiments of this application, the auxiliary filter identification information can be an image-level flag, a slice-level (strip-level) flag, a sub-picture-level flag, or a tile-level flag. This application does not impose any specific limitations.
[0374] Furthermore, in the embodiments of this application, the value of the auxiliary filter identifier information can be used to determine whether vector information is allowed to assist TALF filtering.
[0375] For example, in some embodiments, when the value of the auxiliary filter identifier information is 0, it is determined that vector information is not used to assist TALF filtering. When the value of the auxiliary filter identifier information is 1, it is determined that vector information is used to assist TALF filtering.
[0376] For example, in some embodiments, if the auxiliary filter identifier information is set to false, it is determined that vector information will not be used to assist TALF filtering. If the auxiliary filter identifier information is set to true, it is determined that vector information will be used to assist TALF filtering.
[0377] It should be noted that, in the embodiments of this application, the value of the auxiliary filter identifier information can be in parameter form or in numerical form. Typically, the auxiliary filter identifier information can be a parameter written in the Slice header or picture header, and no limitation is made here.
[0378] Assuming the auxiliary filter flag is an image-level flag, if the value of the auxiliary filter flag is 1, then it can be determined that the current image allows the use of vector information to assist TALF filtering. Otherwise, if the value of the auxiliary filter flag is 0, then it can be determined that the current image does not allow the use of vector information to assist TALF filtering.
[0379] For example, in some embodiments, the auxiliary filtering identification information can be represented by the syntax element `talf_mv_guided_flag`, that is, `talf_mv_guided_flag` indicates whether the current position is allowed to use vector information to assist TALF filtering. If the value of `talf_mv_guided_flag` is 0, it is determined that the current position is not allowed to use vector information to assist TALF filtering; if the value of `talf_mv_guided_flag` is 1, it is determined that the current position is allowed to use vector information to assist TALF filtering.
[0380] Of course, the value of talf_mv_guided_flag is not limited to 0 and 1, and this application does not impose specific restrictions.
[0381] For example, one implementation is that the slice syntax element needs to additionally include an identifier indicating whether a TALF is used with MV assistance, as shown below:
[0382] The `talf_mv_guided_flag` flag indicates whether the TALF in the current chip is based on motion vectors or block vectors for filtering. When the flag is 1, the temporal adaptive loop filtering of the current chip is based on motion vectors and block vectors (vector information); when the flag is 0, the temporal adaptive loop filtering of the current chip is not based on motion vectors and block vectors (vector information). If this syntax element does not exist in the bitstream, its default value of 0 can be used.
[0383] Furthermore, in the embodiments of this application, after determining the auxiliary filter identification information, if it is determined based on the auxiliary filter identification information that vector information is not used to assist TALF filtering, at least one co-position corresponding to the current position is determined in at least one inter-frame reference image corresponding to the current image; filtering is performed based on the reconstructed samples and filter coefficients of at least one co-position to determine the filtered reconstructed value of the current position.
[0384] It is understood that, in the embodiments of this application, if it is determined that vector information is not used to assist TALF filtering, then at least one inter-frame reference image and filter coefficients corresponding to the current image can be determined according to the conventional TALF filtering method, and then TALF filtering can be performed based on at least one inter-frame reference image and filter coefficients.
[0385] In other words, in the embodiments of this application, if the vector information corresponding to the current position in the current image is not used to assist TALF filtering, then at least one inter-frame reference image corresponding to the current image can be further determined.
[0386] Therefore, in the embodiments of this application, the methods for determining the reference image can be different for different scenarios, such as using vector information corresponding to the current position to assist TALF filtering and not using vector information corresponding to the current position to assist TALF filtering, and the final determined reference image can also be different.
[0387] For example, in some embodiments, if vector information is not used to assist TALF filtering, then according to the conventional TALF filtering process, the input image of the determined filter can be an inter-frame reference image, and then filtering can be performed based on the reconstructed samples in at least one inter-frame reference image; if vector information is used to assist TALF filtering, the input image of the determined filter can be an inter-frame reference image or the current image itself, and then filtering can be performed based on the reconstructed samples in at least one inter-frame reference image, or based on the reconstructed samples in the current image.
[0388] Furthermore, in the embodiments of this application, if talf_mv_guided_flag is 0, that is, vector information is not used to assist TALF filtering, Offset0X (first offset value), Offset0Y (second offset value), Offset1X (third offset value) and Offset1Y (fourth offset value) can also be set to 0.
[0389] Furthermore, in the embodiments of this application, if vector information is not used to assist TALF filtering, then according to the conventional TALF filtering process, when determining at least one inter-frame reference image corresponding to the current image and the filter coefficients corresponding to the current block, at least one inter-frame reference image corresponding to the current image and the filter coefficients corresponding to the current block can be determined in the current configuration and in each candidate mode corresponding to the current configuration, respectively.
[0390] Furthermore, in embodiments of this application, for the TALF filter, the corresponding input information may include at least one inter-frame reference image corresponding to the current image, which may be a reconstructed image encoded in the temporal domain. The reconstructed sample values of at least one inter-frame reference image can be used to perform TALF filtering on the current block in the current image.
[0391] It is understood that in the embodiments of this application, the current block can be a CTU determined after dividing the current image, the current block can be a coding unit (CU) obtained after dividing the CTU, or the current block can be a sub-region of any size obtained after dividing the current image. This application does not specifically limit the size and acquisition method of the current block in the current image.
[0392] Furthermore, in the embodiments of this application, when determining at least one inter-frame reference image corresponding to the current image and the filter coefficients corresponding to the current block, a candidate mode can be determined first according to the current configuration; then, under each candidate mode, at least one inter-frame reference image is determined, a candidate filter corresponding to the current block is determined, and the filter coefficients corresponding to the current block are determined based on the candidate filter corresponding to the current block.
[0393] Furthermore, in the embodiments of this application, each candidate mode can be traversed, and in each candidate mode, the candidate filter corresponding to the current block can be determined, and the filter coefficients corresponding to the current block can be determined based on the candidate filter corresponding to the current block.
[0394] It is understood that, in the embodiments of this application, each filtering mode (candidate mode) can be traversed, and the Wienerhof equation can be constructed using the current image reconstruction value under the corresponding mode, the reconstruction value of the reconstructed image (inter-frame reference image), and the original value of the current image, and 1 to 4 sets of filter coefficients can be parsed out. Specifically, for each set of candidate filters that may be used in the current block, the filter coefficients corresponding to that candidate filter can be derived; that is, the filter coefficients corresponding to the current block may include the filter coefficients of each set of candidate filters.
[0395] Step 2003: Filter based on the filtering mode, the reconstructed sample at at least one reference position and the filter coefficients to determine the filtered reconstructed value at the current position.
[0396] In the embodiments of this application, after determining at least one reference position corresponding to the current position based on the filtering mode and the vector information corresponding to the current position, filtering can be further performed based on the filtering mode, the reconstructed samples of at least one reference position and the filter coefficients, so as to determine the filtered reconstructed value of the current position.
[0397] It is understood that, in the embodiments of this application, the filtering process of using vector information to assist TALF filtering can also be understood as reconstructing the image (inter-frame reference image or current image) and filtering coefficients based on the obtained position offset (first position offset value and second position offset value) and filtering the (x, y) position (current position).
[0398] Furthermore, in the embodiments of this application, when filtering is performed based on the filtering mode, the reconstructed sample at at least one reference position and the filter coefficients to determine the filtered reconstructed value at the current position, if the filtering mode satisfies the first condition, the reconstructed sample value at the current position and the reconstructed sample value at the first reference position are determined; and the filtered reconstructed value at the current position is determined according to the filter coefficients, the reconstructed sample value at the current position and the reconstructed sample value at the first reference position.
[0399] In other words, in the embodiments of this application, for a filtering mode that satisfies the first condition, after determining the first position offset value in the first direction and the second position offset value in the second direction based on the first motion vector, and determining the first reference position in the first inter-frame reference image based on the first position offset value and the second position offset value, the reconstructed sample value of the first reference position can be used to filter the current position in combination with the reconstructed sample value and the filter coefficients, thereby determining the filtered reconstructed value of the current position.
[0400] For example, if the syntax element talf_filter_mode is 0, it means that the current slice will use mode 0 (the first mode), and a one-way filter with an offset indicated by MV0 pointing to the reference image list 0 can be used.
[0401] For example, in some embodiments, if the syntax element talf_filter_mode is 2, it means that the current slice will use mode 2 (the third mode), which uses MV0 to find the offset position in reference image 0 for one-way filtering when only MV0 pointing to reference image list 0 exists.
[0402] For example, in some embodiments, if the syntax element talf_filter_mode is 3, it means that the current slice will use mode 3 (the fourth mode), which uses MV0 to find the offset position in reference image 0 for one-way filtering when only MV0 pointing to reference image list 0 exists.
[0403] Furthermore, in the embodiments of this application, when filtering is performed based on the filtering mode, the reconstructed sample at at least one reference position, and the filter coefficients to determine the filtered reconstructed value at the current position, if the filtering mode satisfies the second condition, the reconstructed sample value at the current position and the reconstructed sample value at the second reference position are determined; and the filtered reconstructed value at the current position is determined according to the filter coefficients, the reconstructed sample value at the current position, and the reconstructed sample value at the second reference position.
[0404] In other words, in the embodiments of this application, for a filtering mode that satisfies the second condition, after determining the third position offset value in the first direction and the fourth position offset value in the second direction based on the second motion vector, and determining the second reference position in the second inter-frame reference image based on the third position offset value and the fourth position offset value, the reconstructed sample value of the second reference position can be used to filter the current position in combination with the reconstructed sample value and the filter coefficients, thereby determining the filtered reconstructed value of the current position.
[0405] For example, if the syntax element talf_filter_mode is 1, it means that the current slice will use mode 1 (second mode), and a one-way filter with an offset indicated by MV1 pointing to the reference image list 1 can be used.
[0406] For example, in some embodiments, if the syntax element talf_filter_mode is 2, it means that the current slice will use mode 2 (the third mode), which uses MV1 to find the offset position in reference image 1 for one-way filtering when only MV1 pointing to reference image list 1 exists.
[0407] For example, in some embodiments, if the syntax element talf_filter_mode is 3, it means that the current slice will use mode 3 (the fourth mode), which uses MV1 to find the offset position in reference image 1 for one-way filtering when only MV1 pointing to reference image list 1 exists.
[0408] Furthermore, in the embodiments of this application, for the filtering mode that satisfies the third condition, the filtering process under different filtering modes can be different. Specifically, for different filtering modes, whether to use weights, the filtering input information, and the weight values when using weights can be different.
[0409] Furthermore, in the embodiments of this application, when filtering based on the filtering mode, reconstructed samples at at least one reference position, and filter coefficients to determine the filtered reconstructed value at the current position, for a filtering mode that satisfies the third condition, if the filtering mode is the third mode, or the fourth mode, or the sixth mode, or the eighth mode, the first weight corresponding to the first reference position and the second weight corresponding to the second reference position are determined according to the filtering mode; the filtered reconstructed value at the current position is determined by filtering based on the reconstructed samples at the first reference position, the first weight, the reconstructed samples at the second reference position, the second weight, and the filter coefficients.
[0410] In other words, in the embodiments of this application, if the value of the syntax element talf_filter_mode is 2 and MV0 points to rec0 and MV1 points to rec1 at the same time, or if the value of the syntax element talf_filter_mode is 3 and MV0 points to rec0 and MV1 points to rec1 at the same time, or if the value of the syntax element talf_filter_mode is 5 or 7, then weights need to be introduced for weighting during the filtering process. Therefore, the corresponding weights can be determined for different reference positions first, that is, the first weight corresponding to the first reference position and the second weight corresponding to the second reference position can be determined.
[0411] It should be noted that, in the embodiments of this application, when determining the weight values, a preset value can be used to assign the first weight and the second weight proportionally, or the weighted weight of the already cached inter-frame prediction can be directly referenced to assign the first weight and the second weight. Of course, other assignment methods can also be used to assign the first weight and the second weight, and this application does not impose any specific limitations.
[0412] Furthermore, in the embodiments of this application, the selection of weight values for weighting during the filtering process can introduce two new unidirectional predictions: one is to use a 1:1 weighting ratio when MV0 and MV1 exist, and the other is to use the weighting of inter-frame prediction.
[0413] Furthermore, in the embodiments of this application, weight values are selected to be introduced for weighted processing during the filtering process, which can introduce two new bidirectional predictions: applying inter-frame prediction weights to the original bidirectional prediction and the bidirectional prediction with swapped inputs.
[0414] It is understood that, in the embodiments of this application, the methods for determining weight values may be different for different filtering modes.
[0415] For example, in some embodiments, when determining the first weight corresponding to the first reference position and the second weight corresponding to the second reference position according to the filtering mode, if the filtering mode is a third mode, the first weight and the second weight are set to preset values. The preset values can be non-zero integers, for example, the preset value can be 1.
[0416] In other words, in the embodiments of this application, for the third mode, a preset value can be selected to assign proportional weights to the first weight and the second weight. For example, if the syntax element talf_filter_mode has a value of 2 and both MV0 and MV1 point to rec1, proportional weights can be used to determine the weights corresponding to the two reference positions.
[0417] For example, in some embodiments, when determining the first weight corresponding to the first reference position and the second weight corresponding to the second reference position according to the filtering mode, if the filtering mode is the fourth mode, the sixth mode, or the eighth mode, the first inter-frame prediction weight corresponding to the first reference position and the second inter-frame prediction weight corresponding to the second reference position are determined; the first weight is determined according to the first inter-frame prediction weight, and the second weight is determined according to the second inter-frame prediction weight.
[0418] In other words, in the embodiments of this application, for the fourth mode, or the sixth mode, or the eighth mode, the weighted weights of the already cached inter-frame prediction can be used to assign weights. That is, the first weight corresponding to the first reference position is determined using the first inter-frame prediction weights corresponding to the first reference position, and the second weight corresponding to the second reference position is determined using the second inter-frame prediction weights corresponding to the second reference position. For example, the syntax element talf_filter_mode has a value of 3 and both MV0 and MV1 point to rec1, or the syntax element talf_filter_mode has a value of 5 or 7, and the weights corresponding to the two reference positions are determined using the weighted weights of the inter-frame prediction.
[0419] Furthermore, in the embodiments of this application, when filtering based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the first weight, the reconstructed sample value at the second reference position, the second weight, and the filter coefficients to determine the filtered reconstructed value at the current position, in the case of the filtering mode being the third mode or the fourth mode, the reconstructed sample value at the first reference position, the reconstructed sample value at the second reference position, the first weight, and the second weight are weighted to determine the weighted sample value; and the reconstructed sample value at the current position is determined by filtering based on the reconstructed sample value at the current position, the weighted sample value, and the filter coefficients.
[0420] In other words, in the embodiments of this application, for the filtering process that introduces weights for weighted processing, if the filtering mode is the third mode or the fourth mode, the reconstructed sample value of the first reference position and the reconstructed sample value of the second reference position can be weighted using the first weight and the second weight to obtain a weighted sample value; then the weighted sample value is used for unidirectional filtering, that is, filtering is performed based on the reconstructed sample value of the current position, the weighted sample value and the filter coefficients to determine the filtered reconstructed value of the current position.
[0421] For example, in some embodiments, if the syntax element talf_filter_mode is 2, it means that the current slice will use mode 2 (third mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and uses equal weights to weight the reconstructed pixels at the two reference positions to obtain a weighted signal, and performs unidirectional filtering.
[0422] For example, in some embodiments, if the syntax element talf_filter_mode is 3, it means that the current slice will use mode 3 (fourth mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and uses the weighted weight of inter-frame prediction to weight the reconstructed pixels at the two reference positions to obtain the weighted signal, and performs unidirectional filtering.
[0423] Furthermore, in the embodiments of this application, when filtering based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the first weight, the reconstructed sample value at the second reference position, the second weight, and the filter coefficients to determine the filtered reconstructed value at the current position, in the case of the sixth filtering mode, the weighted sample value corresponding to the first reference position is determined based on the reconstructed sample value at the first reference position and the first weight, and the weighted sample value corresponding to the second reference position is determined based on the reconstructed sample value at the second reference position and the second weight; the filtered reconstructed value at the current position is determined by filtering based on the reconstructed sample value at the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position, and the filter coefficients.
[0424] In other words, in the embodiments of this application, for the filtering process that introduces weights for weighted processing, if the filtering mode is the sixth mode, the reconstructed sample value at the first reference position can be weighted using the first weight, and the reconstructed sample value at the second reference position can be weighted using the second weight to obtain two weighted sample values, namely, the weighted sample value corresponding to the first reference position and the weighted sample value corresponding to the second reference position; then, these two weighted sample values are used for bidirectional filtering, that is, filtering is performed based on the reconstructed sample value at the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position, and the filter coefficients to determine the filtered reconstructed value at the current position.
[0425] For example, in some embodiments, if the syntax element talf_filter_mode is 5, it means that the current slice will use mode 5 (sixth mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1. The reconstructed signals at the two reference positions are respectively weighted by inter-frame bidirectional prediction and used as the input of the two filters of bidirectional filtering for bidirectional filtering.
[0426] Furthermore, in the embodiments of this application, when filtering based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the first weight, the reconstructed sample value at the second reference position, the second weight, and the filter coefficients to determine the filtered reconstructed value at the current position, in the case of the eighth filtering mode, the weighted sample value corresponding to the second reference position is determined based on the reconstructed sample value at the first reference position and the first weight, and the weighted sample value corresponding to the first reference position is determined based on the reconstructed sample value at the second reference position and the second weight; the filtered reconstructed value at the current position is determined by filtering based on the reconstructed sample value at the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position, and the filter coefficients.
[0427] In other words, in the embodiments of this application, for the filtering process that introduces weights for weighted processing, if the filtering mode is the eighth mode, the first weight can be used to weight the reconstructed sample value at the first reference position, and the second weight can be used to weight the reconstructed sample value at the second reference position to obtain two weighted sample values, that is, the weighted sample value corresponding to the first reference position and the weighted sample value corresponding to the second reference position are obtained; then the input positions of the two sample values are swapped, and bidirectional filtering is performed, that is, filtering is performed based on the reconstructed sample value at the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position, and the filter coefficients to determine the filtered reconstructed value at the current position.
[0428] For example, in some embodiments, if the syntax element talf_filter_mode is 7, it means that the current slice will use mode 7 (eighth mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1. After applying the weights of inter-frame bidirectional prediction to the reconstructed signals at the two reference positions and swapping the input positions, it uses them as the input of the two filters for bidirectional filtering.
[0429] Furthermore, in the embodiments of this application, when filtering based on the filtering mode, the reconstructed samples at at least one reference position, and the filter coefficients to determine the filtered reconstructed value at the current position, for the filtering mode that satisfies the third condition, if the filtering mode is the fifth mode or the seventh mode, the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, and the reconstructed sample value at the second reference position are determined; the filtered reconstructed value at the current position is determined by filtering based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the reconstructed sample value at the second reference position, and the filter coefficients.
[0430] In other words, in the embodiments of this application, for the fifth mode or the seventh mode, weights can be omitted during the filtering process. Instead, after determining the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, and the reconstructed sample value at the second reference position, filtering is performed based on the reconstructed sample value at the current position, the reconstructed sample value at the first reference position, the reconstructed sample value at the second reference position, and the filter coefficients to finally determine the filtered reconstructed value at the current position.
[0431] For example, in some embodiments, if the syntax element talf_filter_mode is 4, it means that the current slice will use mode 4 (the fifth mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and uses the reconstructed signals at the two reference positions as inputs to the two filters of bidirectional filtering to perform bidirectional filtering.
[0432] For example, in some embodiments, if the syntax element talf_filter_mode is 6, it means that the current slice will use mode 6 (seventh mode). When there is MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 at the same time, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and swaps the input positions of the reconstructed signals at the two reference positions as the input of the two filters for bidirectional filtering.
[0433] Furthermore, in embodiments of this application, if it is determined that vector information is not used to assist TALF filtering, then filtering can be performed based on the reconstructed samples and filter coefficients of at least one inter-frame reference image to determine the filtered reconstructed value at the current position.
[0434] It should be noted that, in the embodiments of this application, after determining that the current block is filtered using TALF based on the first syntax element identification information, and determining at least one inter-frame reference image corresponding to the current image and the filter coefficients corresponding to the current block, the current block can be further filtered based on the reconstructed samples of at least one inter-frame reference image and the filter coefficients corresponding to the current block to determine the filtered reconstructed value of the current block.
[0435] Furthermore, in the embodiments of this application, when determining the filtered reconstructed sample value of the current sample position based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, and the reconstructed sample value of the reference sample position, a first sample difference can be determined based on the reconstructed sample value of the current sample position and the reconstructed sample value of the reference sample position; and then the filtered reconstructed sample value of the current sample position can be determined based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, and the first sample difference.
[0436] In other words, in the embodiments of this application, it is also possible to first determine the first sample difference based on the reconstructed sample value at the current sample position and the reconstructed sample value at the reference sample position, and then use the first sample difference as the input of the filter.
[0437] Furthermore, in the embodiments of this application, when determining the filtered reconstructed sample value of the current sample position based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, and the reconstructed sample value of the reference sample position, the filtering position corresponding to the reference sample position can be determined in the current block, and the reconstructed sample value of the filtering position can be determined based on the reconstructed value of the current block; the second sample difference can be determined based on the reconstructed sample value of the filtering position and the reconstructed sample value of the reference sample position; and the filtered reconstructed sample value of the current sample position can be determined based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, and the second sample difference.
[0438] In other words, in the embodiments of this application, it is also possible to select, for each filtering position, a second sample difference value is determined based on the reconstructed sample value of the filtering position and the reconstructed sample value of the reference sample position, and then the second sample difference value is used as the input of the filter.
[0439] Further, in the embodiments of this application, when filtering the current block based on the reconstructed samples of at least one inter-frame reference image and the filter coefficients corresponding to the current block to determine the filtered reconstructed value of the current block, for the current sample position in the current block, the reconstructed sample value of the current sample position is determined according to the reconstructed value of the current block; the reconstructed sample value of the first reference sample position corresponding to the current sample position is determined according to the reconstructed samples of the first inter-frame reference image; the reconstructed sample value of the second reference sample position corresponding to the current sample position is determined according to the reconstructed samples of the second inter-frame reference image; the filtered reconstructed sample value of the current sample position is determined according to the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the reconstructed sample value of the first reference sample position, and the reconstructed sample value of the second reference sample position; and the filtered reconstructed value of the current block is determined according to the filtered reconstructed sample value of the current sample position.
[0440] Furthermore, in the embodiments of this application, when determining the filtered reconstructed sample value of the current sample position based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the reconstructed sample value of the first reference sample position, and the reconstructed sample value of the second reference sample position, a third sample difference can be determined based on the reconstructed sample value of the current sample position and the reconstructed sample value of the first reference sample position; a fourth sample difference can be determined based on the reconstructed sample value of the current sample position and the reconstructed sample value of the second reference sample position; and the filtered reconstructed sample value of the current sample position can be determined based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the third sample difference, and the fourth sample difference.
[0441] In other words, in the embodiments of this application, it is also possible to first determine the third sample difference and the fourth sample difference based on the reconstructed sample value at the current sample position and the reconstructed sample values at the two reference sample positions, and then use the third sample difference and the fourth sample difference as the input of the filter.
[0442] Furthermore, in the embodiments of this application, when determining the filtered reconstructed sample value of the current sample position based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the reconstructed sample value of the first reference sample position, and the reconstructed sample value of the second reference sample position, the filtering position corresponding to the reference sample position can be determined in the current block, and the reconstructed sample value of the filtering position can be determined based on the reconstructed value of the current block; the fifth sample difference can be determined based on the reconstructed sample value of the filtering position and the reconstructed sample value of the first reference sample position; the sixth sample difference can be determined based on the reconstructed sample value of the filtering position and the reconstructed sample value of the second reference sample position; and the filtered reconstructed sample value of the current sample position can be determined based on the filter coefficients corresponding to the current block, the reconstructed sample value of the current sample position, the fifth sample difference, and the sixth sample difference.
[0443] In other words, in the embodiments of this application, it is also possible to select, for each filtering position, to determine the fifth sample difference and the sixth sample difference based on the reconstructed sample value of the filtering position and the reconstructed sample values of the two reference sample positions respectively, and then use the fifth sample difference and the sixth sample difference as the input of the filter.
[0444] It should be noted that, in the embodiments of this application, the filter coefficients can be integers, and the parameters used in the filtering process may also include bias and shift.
[0445] Furthermore, in the embodiments of this application, the reconstructed value of the current block can be either the reconstructed value of the luminance component of the current block or the reconstructed value of the chrominance component of the current block; this application does not impose any specific limitation.
[0446] In other words, in the embodiments of this application, TALF filtering can be applied to any image component of the current image.
[0447] It should be noted that, in the embodiments of this application, the image components of the current image in the video image may include a first image component, a second image component, and a third image component. These three image components are respectively a luminance component, a blue color component, and a red color component. Specifically, the luminance component is typically represented by the symbol Y, the blue color component is typically represented by the symbol Cb or U, and the red color component is typically represented by the symbol Cr or V; thus, the video image can be represented in YCbCr format or YUV format.
[0448] Furthermore, in the embodiments of this application, the shape, size, and number of taps of the filter used in the TALF filtering process are not specifically limited; that is, filters of any shape and size can be applied to TALF filtering. For example, the shapes of the filters used in the TALF filtering process include, but are not limited to, diamond-shaped, cross-shaped, rectangular, and square.
[0449] It is understood that the decoding method proposed in this application embodiment can use TALF for either the luminance component or the chrominance component.
[0450] It is understood that in the decoding method proposed in this application, the TALF switch identifier can be at any level. For example, the TALF can be switched on by image as a unit, or by CTU as a unit, or by CU as a unit, or by other methods of dividing the image into sub-regions.
[0451] It is understood that the decoding method proposed in this application embodiment may also choose to skip the encoding and decoding process of the CTU identifier and directly decide whether to perform TALF filtering on the entire image based on the image-level identifier. In this case, the current image corresponds to only one candidate filter.
[0452] Furthermore, in the embodiments of this application, after filtering the current block based on the reconstructed samples of at least one inter-frame reference image and the filter coefficients corresponding to the current block, and determining the filtered reconstructed value of the current block, a first generation value can be further determined based on the filtered reconstructed value of the current block, and a first syntax element identification information can be determined based on the first generation value, and the first syntax element identification information can be written into the bitstream; wherein, the first syntax element identification information is used to determine whether the current block uses TALF for filtering.
[0453] Furthermore, in the embodiments of this application, when determining the first generation value based on the filtered reconstructed value of the current block, in each candidate mode, the second generation value of the filter coefficients corresponding to the current block is determined based on the filtered reconstructed value of the current block; the minimum second generation value is determined as the first generation value corresponding to the current block when filtered using TALF.
[0454] It is understood that, in the embodiments of this application, each candidate filter can be traversed in each candidate mode to determine the second generation value corresponding to the filter coefficients of the current block after filtering. The method for calculating the generation value includes, but is not limited to, rate-distortion optimization algorithms.
[0455] Accordingly, in the embodiments of this application, in each candidate mode, multiple second-generation values can be calculated by traversing the candidate filters and multiple possible combinations of filter coefficients, and then the minimum generation value among the multiple second-generation values can be determined as the first-generation value corresponding to the current block when using TALF for filtering in this candidate mode.
[0456] Furthermore, in the embodiments of this application, when determining the first syntax element identification information based on the first generation value, the third generation value corresponding to the current block not using TALF for filtering can be determined; if the first generation value is greater than or equal to the third generation value, the first syntax element identification information is set to indicate that the current block does not use TALF for filtering; if the first generation value is less than the third generation value, the first syntax element identification information is set to indicate that the current block uses TALF for filtering.
[0457] It is understood that, in the embodiments of this application, rate-distortion optimization can be used to determine whether each CTU should enable TALF filtering based on 1 to 4, calculate the optimal number of filter groups for each mode, and determine whether each CTU uses TALF and which TALF filter group should be used.
[0458] It should be noted that, in the embodiments of this application, the cost value can be calculated in any way, including but not limited to the rate-distortion optimization (RDO) algorithm.
[0459] Furthermore, in the embodiments of this application, the first syntax element identification information can be used to determine whether the current block in the current image is filtered using TALF, that is, based on the first syntax element identification information, it can be determined whether the reconstructed value of the image component of the current block is filtered using a TALF filter.
[0460] Furthermore, in the embodiments of this application, the first syntax element identification information can be used to determine whether to use TALF to filter the current block. The first syntax element identification information can be a flag, wherein if the current block is a CTU corresponding to the current image, then the first syntax element identification information can be a CTU-level flag; if the current block is a CU corresponding to the current image, then the first syntax element identification information can be a CU-level flag. Of course, corresponding to any size sub-region in the current image, the first syntax element identification information can also be a flag of other block levels. This application does not impose specific limitations.
[0461] Furthermore, in the embodiments of this application, the value of the first syntax element identifier information can be used to determine whether to use TALF filtering on the current block.
[0462] For example, in some embodiments, if the value of the first syntax element identifier information is a first value, it is determined that TALF filtering will not be used on the current block. If the value of the first syntax element identifier information is not a first value, it is determined that TALF filtering will be used on the current block.
[0463] It should be noted that, in the embodiments of this application, the first syntax element identification information can be used to indicate whether the current block uses TALF for filtering. Furthermore, the first value can be in parameter form or numeric form; no limitation is made here.
[0464] For example, in some embodiments, if the first syntax element identification information is a block-level flag, then in one specific example, the first value can be set to 0; in another specific example, the first value can also be set to false. The first value is not limited in any way in the embodiments of this application.
[0465] Taking a first value of 0 as an example, in this embodiment of the application, if the value of the first syntax element identifier information is 0, then it can be determined that the current block does not use TALF for filtering. Otherwise, if the value of the first syntax element identifier information is not 0, then it can be determined that the current block uses TALF for filtering.
[0466] For example, in some embodiments, if the current block of the current image is a CTU, then the first syntax element identification information can be CTU-level syntax. For instance, the first syntax element identification information can be represented by the syntax element control identifier talf_ctb_idc[CtbAddrX][CtbAddrY], that is, talf_ctb_idc[CtbAddrX][CtbAddrY] indicates whether to use TALF filtering on the current block of the current image. If the value of talf_ctb_idc[CtbAddrX][CtbAddrY] is 0, it is determined that TALF filtering is not used on the current block; if the value of talf_ctb_idc[CtbAddrX][CtbAddrY] is not 0, it is determined that TALF filtering is used on the current block. Of course, the value of talf_ctb_idc[CtbAddrX][CtbAddrY] is not limited to 0, and this application does not impose specific limitations.
[0467] Furthermore, in the embodiments of this application, in each candidate mode, the fourth generation value corresponding to each candidate mode when the current image is filtered using TALF can be determined based on the filtered reconstructed value of the current block; the minimum fourth generation value is determined as the fifth generation value corresponding to the current image when the current image is filtered using TALF.
[0468] Furthermore, in the embodiments of this application, the sixth generation value corresponding to the current image when TALF is not used for filtering is determined; if the fifth generation value is greater than or equal to the sixth generation value, a second syntax element identifier is set to indicate that the current image is not used for TALF filtering; if the fifth generation value is less than the sixth generation value, a second syntax element identifier is set to indicate that the current image is used for TALF filtering.
[0469] Furthermore, in an embodiment of this application, when the second syntax element identification information indicates that the current image is filtered using TALF, the first syntax element is written into the bitstream.
[0470] Furthermore, in embodiments of this application, the second syntax element identification information can be used to determine whether the current image is allowed to be filtered using TALF. The second syntax element identification information can be a flag.
[0471] It should be noted that, in the embodiments of this application, the second syntax element identification information can be an image-level flag, a slice-level flag, a sub-picture-level flag, or a tile-level flag. This application does not impose any specific limitations.
[0472] For example, in some embodiments, if the second syntax element identification information is a slice-level flag, then the second syntax element identification information can be used to determine whether the current slice is allowed to use TALF for filtering.
[0473] Furthermore, in the embodiments of this application, the value of the second syntax element identifier information can be used to determine whether the current image (and / or the current slice) is allowed to use TALF for filtering.
[0474] For example, in some embodiments, if the value of the second syntax element identifier information is a second value, it is determined that the current image (and / or the current slice) is allowed to be filtered using TALF. If the value of the second syntax element identifier information is a third value, it is determined that the current image (and / or the current slice) is not filtered using TALF.
[0475] It should be noted that, in the embodiments of this application, the second syntax element identification information can be used to indicate whether the current image (and / or the current slice) is filtered using TALF. Furthermore, the second value and the third value are different, and the second value and the third value can be in parameter form or in numerical form; no limitation is made here.
[0476] It should also be noted that if the second syntax element identifier is an image-level flag or a slice-level flag, then in one specific example, the second value can be set to 1 and the third value can be set to 0; in another specific example, the second value can also be set to true and the third value can also be set to false; even in yet another specific example, the second value can also be set to 0 and the third value can also be set to 1; or, the second value can also be set to false and the third value can also be set to true. The second and third values are not limited in any way in the embodiments of this application.
[0477] Assuming the second syntax element identifier is an image-level flag, with a second value of 1 and a third value of 0 as an example, in this embodiment, if the value of the second syntax element identifier is 1, it can be determined that the current image uses TALF filtering. Otherwise, if the value of the second syntax element identifier is 0, it can be determined that the current image does not use TALF filtering.
[0478] For example, in some embodiments, assuming the second syntax element identification information is an image-level flag, then the second syntax element identification information can be represented by the syntax element ph_talf_enabled_flag, that is, ph_talf_enabled_flag indicates whether the current image is allowed to use TALF filtering. If the value of ph_talf_enabled_flag is 0, it is determined that TALF filtering is not used on the current image; if the value of ph_talf_enabled_flag is 1, it is determined that TALF filtering is allowed on the current image.
[0479] For example, in some embodiments, assuming the second syntax element identification information is a slice-level flag, the second syntax element identification information can be represented by the syntax element sh_talf_enabled_flag, that is, sh_talf_enabled_flag indicates whether the current slice is allowed to use TALF filtering. If the value of sh_talf_enabled_flag is 0, it is determined that TALF filtering is not used for the current slice; if the value of sh_talf_enabled_flag is 1, it is determined that TALF filtering is allowed for the current slice.
[0480] Of course, the value of sh_talf_enabled_flag is not limited to 0 and 1, and this application does not impose specific restrictions.
[0481] Therefore, in the embodiments of this application, the encoding of the first syntax element identifier information may depend on the second syntax element identifier information. That is, the block-level identifier may depend on the image-level identifier, or the block-level identifier may depend on the slice-level identifier. For example, if it is determined that the current image (and / or the current slice) is to be filtered using TALF based on the second syntax element identifier information, the encoding of the first syntax element identifier information can be further performed; otherwise, it is not necessary to encode the first syntax element identifier information.
[0482] Furthermore, in the embodiments of this application, a third syntax element identification information can be determined and written into the bitstream; wherein, the third syntax element identification information is used to determine whether the current sequence uses TALF for filtering; if the third syntax element identification information indicates that the current sequence uses TALF for filtering, the second syntax element is written into the bitstream.
[0483] Furthermore, in embodiments of this application, the third syntax element identification information can be used to determine whether to apply TALF filtering to the current sequence. The third syntax element identification information can be a flag, for example, a sequence-level flag.
[0484] Furthermore, in the embodiments of this application, the value of the third syntax element identifier information can be used to determine whether to use TALF filtering on the current sequence.
[0485] For example, in some embodiments, if the value of the third syntax element identifier information is a fourth value, it is determined that TALF filtering should be applied to the current sequence. If the value of the third syntax element identifier information is a fifth value, it is determined that TALF filtering should not be applied to the current sequence.
[0486] It should be noted that, in the embodiments of this application, the third syntax element identification information can be used to indicate whether the current sequence is filtered using TALF. Furthermore, the fourth and fifth values are different, and both can be in parameter form or numerical form; no limitation is made here.
[0487] It should also be noted that if the third syntax element identifier is a sequence-level flag, then in one specific example, the fourth value can be set to 1 and the fifth value can be set to 0; in another specific example, the fourth value can also be set to true and the fifth value can also be set to false; even in yet another specific example, the fourth value can also be set to 0 and the fifth value can also be set to 1; or, the fourth value can also be set to false and the fifth value can also be set to true. The fourth and fifth values are not limited in any way in the embodiments of this application.
[0488] Assuming the third syntax element identifier is a sequence-level flag, with the fourth value being 1 and the fifth value being 0, in this embodiment, if the value of the third syntax element identifier is 1, then it can be determined that the current sequence uses TALF filtering. Otherwise, if the value of the third syntax element identifier is 0, then it can be determined that the current sequence does not use TALF filtering.
[0489] For example, in some embodiments, assuming the third syntax element identification information is a sequence-level flag, the third syntax element identification information can be represented by the syntax element `sps_talf_enabled_flag`, that is, `sps_talf_enabled_flag` indicates whether to use TALF filtering on the current sequence. If the value of `sps_talf_enabled_flag` is 0, it is determined that TALF filtering is not used on the current sequence; if the value of `sps_talf_enabled_flag` is 1, it is determined that TALF filtering is used on the current sequence.
[0490] Of course, the value of sps_talf_enabled_flag is not limited to 0 and 1, and this application does not impose specific restrictions.
[0491] Therefore, in the embodiments of this application, the encoding of the second syntax element identifier information can depend on the third syntax element identifier information; that is, the image-level (and / or slice-level) identifier can depend on the sequence-level identifier. For example, if it is determined that the current sequence is to be filtered using TALF based on the third syntax element identifier information, the encoding of the second syntax element identifier information can be further performed; otherwise, it is not necessary to encode the second syntax element identifier information.
[0492] Furthermore, in the embodiments of this application, the sequence-level TALF identifier may depend on the sequence-level ALF identifier, that is, the encoding of the third syntax element identifier information may be dependent on the sequence-level syntax element encoding of the ALF.
[0493] Furthermore, in embodiments of this application, the image-level (and / or slice-level) identifier depends on the sequence-level identifier, which may include the image-level (and / or slice-level) TALF identifier depending on the sequence-level TALF identifier, and may also include the image-level (and / or slice-level) TALF identifier depending on the sequence-level ALF identifier.
[0494] In other words, in the embodiments of this application, the encoding of the second syntax element identification information can depend on the third syntax element identification information or on the sequence-level ALF identifier.
[0495] Furthermore, in embodiments of this application, the image-level (and / or slice-level) TALF identifier may also depend on the image-level (and / or slice-level) ALF identifier.
[0496] In other words, in the embodiments of this application, the encoding of the second syntax element identification information may also rely on the image-level (and / or slice-level) ALF identifier.
[0497] For example, in some embodiments, the image-level (and / or slice-level) TALF identifier may also rely on some high-level syntax, such as the high-level syntax element pps_alf_info_in_ph_flag to identify the image-level or slice-level control identifier that uses image-level or slice-level syntax elements to parse the ALF, and the ALF identifier may also exist in the slice header.
[0498] Furthermore, in the embodiments of this application, after selecting the optimal candidate mode, candidate filter, and corresponding filter coefficients based on the rate-distortion optimization algorithm, the TALF parameters can be further determined, and the TALF parameters and the filter coefficients corresponding to the current block can be written into the bitstream. The TALF parameters include one or more of the following: mode parameters, quantity parameters, coefficient value parameters, and coefficient sign parameters.
[0499] It is understood that, in the embodiments of this application, the mode parameter can be used to determine the filtering mode of the TALF filter, wherein, for different filtering modes, the inter-frame reference image corresponding to the current image can be different. The quantity parameter can be used to determine the number of filter groups corresponding to the current image. The coefficient value parameter can be used to determine the absolute value of the filter coefficients. The coefficient sign parameter can be used to determine the sign of the filter coefficients, including positive and negative signs.
[0500] For example, in some embodiments, the coefficient numerical parameters can be determined based on the values of the filter coefficients corresponding to the current block; the coefficient sign parameters can be determined based on the signs of the filter coefficients corresponding to the current block; and the TALF parameters can be determined based on the coefficient numerical parameters and the coefficient sign parameters, that is, the coefficient numerical parameters and coefficient sign parameters in the TALF parameters can be determined.
[0501] For example, in some embodiments, the filtering mode and the number of candidate filter groups corresponding to the fifth-generation value can be determined; the mode parameter is determined according to the filtering mode and the current configuration; the quantity parameter is determined according to the number of candidate filter groups; and the TALF parameter is determined according to the mode parameter and the quantity parameter, that is, the mode parameter and the quantity parameter in the TALF parameter are determined.
[0502] Furthermore, in the embodiments of this application, the APS set corresponding to the TALF parameter can be determined; then the APS index corresponding to the APS set can be determined, and the APS index can be written into the bitstream.
[0503] It is understood that, in the embodiments of this application, the APS index can be used to determine the APS parameter set corresponding to the current image, that is, the APS set corresponding to the current image can be determined through the APS index.
[0504] In other words, in the embodiments of this application, the TALF parameters corresponding to the current image can be stored in the APS, so that the TALF parameters can be obtained by parsing in the APS.
[0505] Furthermore, in the embodiments of this application, the TALF parameters can also be directly written into the bitstream.
[0506] In other words, in the embodiments of this application, the TALF parameters corresponding to the current image can also be directly written into the bitstream. For example, the TALF parameters can be encoded and decoded in the image perspective or in the title sequence.
[0507] It is understood that, in the embodiments of this application, the first syntax element identification information can also be used to determine the TALF information used by the current block. For example, the value of the first syntax element identification information can be set according to the candidate filter corresponding to the current block that is finally determined.
[0508] For example, in some embodiments, when the value of the first syntax element identifier information is a first value, it indicates that TALF filtering should not be used on the current block. When the value of the first syntax element identifier information is not a first value, it indicates that TALF filtering should be used on the current block. The candidate filter corresponding to the current block can be indicated by setting the value of the first syntax element identifier information.
[0509] It is understood that, in the embodiments of this application, when it is determined that TALF filtering is applied to the current block, the value of the first syntax element identifier information can be set to indicate the group index of the filter corresponding to the current block. The group index of the filter can represent the index of the TALF filter used by the current block in the filter set encoded and decoded in the current image; that is, the group index of the filter can be used to select the candidate filter corresponding to the current block from among multiple filters corresponding to the current image.
[0510] For example, in the embodiments of this application, the reconstructed image is filtered using the optimal filtering mode optimized by rate distortion, the number of filter groups, and the CTU switch. At the same time, the filtering mode, the number of filter groups, the filter coefficients are encoded in the image header, and information such as the CTU switch is encoded in each CTU unit.
[0511] It is understood that the encoding method proposed in this application embodiment, TALF can be used for either the luminance component or the chrominance component.
[0512] It is understood that in the encoding method proposed in this application, the switch identifier of TALF can be at any level. For example, TALF can be switched on by image as a unit, or on by CTU as a unit, or on by CU as a unit, or on by other methods of dividing the image into sub-regions.
[0513] It is understood that the encoding method proposed in the embodiments of this application may also choose to skip the encoding and decoding process of the CTU identifier and directly decide whether to perform TALF filtering on the entire image through the image-level identifier. In this case, the current image corresponds to only one candidate filter.
[0514] In the encoding and decoding method proposed in the embodiments of this application, the methods of imparting equal weights to unidirectional or bidirectional filtering and imparting bidirectional prediction weights to unidirectional or bidirectional filtering can correspond to the filtering modes when talf_filter_mode is 2, 3, 4, 5, 6, and 7, respectively.
[0515] It is understood that in the embodiments of this application, the value of talf_filter_mode is not limited to 0-7. For example, talf_filter_mode can be 0, 1, 2, 3, 4, 5, which corresponds to 6 filtering modes. For these 6 filtering modes, the weighted one-way or two-way filtering proposed in this application can also be used. This application does not make any specific limitations.
[0516] Furthermore, in the embodiments of this application, since there is only one reference image list and only one-way prediction can be used for a frame during unidirectional inter-frame prediction (P-frame), the temporal adaptive loop filter should only have talf_filter_mode 0 during P-frame, and other modes are not applicable to P-frame. Therefore, when the current slice uses temporal adaptive loop filtering during P-frame, the value of talf_filter_mode does not need to be encoded, but its default value is directly zero.
[0517] Accordingly, in the embodiments of this application, the encoding talf_filter_mode can be based on the current inter-frame coded slice being a B-slice.
[0518] For example, in some embodiments, a variable can be used to indicate whether it is a B-slice, such as isInterBSlice, that is, isInterBSlice can be a variable for determining whether the current slice is a bidirectional prediction slice.
[0519] In other words, in the embodiments of this application, the encoding of the syntax element talf_filter_mode can depend on the value of the variable isInterBSlice.
[0520] Furthermore, in the embodiments of this application, temporal adaptive loop filtering is a technique implemented on inter-frame coded frames, so it can be chosen not to use temporal adaptive loop filtering for intra-frame coded frames. Accordingly, a variable can be used to indicate whether it is a non-intra-coded slice, for example, isIntraSlice, that is, isIntraSlice can be a variable to determine whether the current slice is a non-intra-coded slice.
[0521] In other words, in the embodiments of this application, the encoding of the syntax element sh_talf_enabled_flag can depend on the value of the variable isIntraSlice.
[0522] Therefore, the encoding / decoding method proposed in the embodiments of this application can use equal weighting or inter-frame prediction weighting to weight the input values of the two reference positions at the bidirectional inter-frame prediction positions, and use them as inputs for unidirectional temporal adaptive loop filtering. Alternatively, equal weighting or inter-frame prediction weighting can be used to assign weights to the two inputs of the bidirectional adaptive loop filtering, and then implement bidirectional adaptive loop filtering.
[0523] In other words, the encoding / decoding method proposed in this application, during the process of TALF filtering assisted by vector information, can further introduce corresponding weights for the reference positions after obtaining the reference positions using motion vectors or block vectors, and perform weighted calculations based on the reference positions and corresponding weights to complete the TALF filtering of the sample positions. The introduction of weights and weighted processing can, on the one hand, provide filtering modes applicable to more filtering scenarios, and on the other hand, improve the accuracy of the TALF filtering input information, thereby further improving the filtering effect and enhancing encoding / decoding performance.
[0524] This application provides an encoding method that, during TALF filtering, combines filtering modes and uses vector information (including motion vectors or block vectors) corresponding to the sample position to obtain the corresponding reference position. Simultaneously, the TALF filtering of the sample position is performed based on the reference position within the corresponding filtering mode. For one or more filtering modes, weights can be introduced during the filtering process for weighted averaging. In other words, this application, combined with weights determined by the filtering mode, introduces vector information to assist TALF filtering, thereby further improving the filtering effect and enhancing encoding / decoding performance.
[0525] Based on the above embodiments, this application proposes a temporal adaptive loop filtering technique. During TALF filtering, vector information including motion vectors or block vectors corresponding to the sample position can be used to obtain the corresponding reference position. TALF filtering of the sample position is then performed based on this reference position, i.e., vector information is introduced to assist TALF filtering. Furthermore, in the process of using vector information to assist TALF filtering, after obtaining the reference position using motion vectors or block vectors, corresponding weights can be introduced for the reference position. A weighted calculation is then performed based on the reference position and the corresponding weights to complete the TALF filtering of the sample position. The introduction of weights and weighted processing can, on the one hand, provide filtering modes applicable to more filtering scenarios, and on the other hand, improve the accuracy of the TALF filtering input information, thereby further improving the filtering effect and enhancing encoding / decoding performance.
[0526] This application proposes a technique to improve the quality of a current image by reconstructing an image in the temporal domain. This technique involves an encoder acquiring one or more sets of filter coefficients for improving the quality of the reconstructed image and transmitting them through a bitstream; and a decoder using the parsed filter coefficients and information including, but not limited to, the reconstructed values in the temporal domain as input to filter the current image.
[0527] This application proposes a technique to improve the quality of a current image by reconstructing the image in the temporal domain. Alternatively, the encoder can select appropriate filters and coefficients from one or more predefined sets of filters and coefficients, and transmit the syntax elements related to whether to use filters and coefficients through the bitstream. The decoder determines the filters and coefficients by parsing the syntax elements, and uses information including but not limited to the reconstructed values in the temporal domain as input to filter the current image.
[0528] This application proposes a technique to improve the quality of a current image by reconstructing an image in the temporal domain. Alternatively, the encoder can select predefined filters and coefficients and / or obtain coefficients that need to be transmitted through the bitstream, and transmit the corresponding syntax elements through the bitstream; the decoder determines to use predefined filters and coefficients by parsing the syntax elements, and / or parses the filters and coefficients from the bitstream, and uses information including but not limited to the reconstructed values in the temporal domain as input to filter the current image.
[0529] Furthermore, in the embodiments of this application, for the TALF filter, in addition to at least one inter-frame reference image that has been decoded in the temporal domain, the corresponding input information may also include the reconstructed value of the current block, such as the reconstructed value of any image component of the current block. The reconstructed value of the current block can be obtained by processing the current block in the current image based on any loop filtering method.
[0530] In other words, in the embodiments of this application, this application does not specifically limit the method for determining the reconstructed value of the current block. Correspondingly, this application does not specifically limit the specific position of TALF filtering in the loop filtering process, that is, the position of the time domain adaptive loop filtering can be located at any point in the loop filtering.
[0531] For example, in some embodiments, FIG11 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application. As shown in FIG11, the input of TALF may include the reconstructed value on the reconstructed image of the decoded and reconstructed image in the time domain and the current image before ALF filtering.
[0532] For example, in some embodiments, FIG12 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application. As shown in FIG12, the input of TALF may include the reconstructed image of the decoded and reconstructed image in the time domain and the reconstructed image of the current image after deblocking. That is, TALF can be placed in the same position as SAO in the loop filtering.
[0533] For example, in some embodiments, Figure 13 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application. As shown in Figure 13, TALF can be placed alongside Deblocking in the loop filtering.
[0534] For example, in some embodiments, Figure 14 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application. As shown in Figure 14, the position of TALF in the loop filtering can be before Deblocking.
[0535] For example, in some embodiments, Figure 15 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application. As shown in Figure 15, the input of TALF may include the reconstructed image of the decoded and reconstructed image in the time domain and the reconstructed image of the current image after deblocking. That is, the position of TALF in the loop filtering can be after deblocking.
[0536] For example, in some embodiments, FIG16 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application. As shown in FIG16, the input of TALF may include the reconstructed image of the decoded and reconstructed image in the time domain and the reconstructed image of the current image after SAO. That is, the position of TALF in the loop filtering can be after SAO.
[0537] For example, in some embodiments, FIG17 is a schematic diagram of the implementation of TALF filtering proposed in the embodiments of this application. As shown in FIG17, the input of TALF may also include the reconstructed value on the reconstructed image of the time-domain decoded reconstructed image and the current image after ALF filtering, that is, the position of TALF in the loop filtering may be after ALF.
[0538] Therefore, in some embodiments, the TALF can be placed at any position in a series of loop filters, which means that the input of the TALF includes the decoded image and the reconstructed value on the reconstructed image at any stage of the current loop filter.
[0539] It should be noted that, in the embodiments of this application, the temporal adaptive loop filtering can be divided into unidirectional filtering and bidirectional filtering. Unidirectional filtering uses one MV / BV to indicate the current position's offset in the reference image, uses the offset position as the filter center position, and generates a correction value for the current position using the reconstructed value of the reference image and the unidirectional filter to complete the filtering. Bidirectional filtering uses two MV / BV to indicate the current position's offset in the reference image, uses the two offset positions as the filter center positions, and generates a correction value for the current position using the reconstructed value of the reference image and the bidirectional filter to complete the filtering.
[0540] For example, in some embodiments, FIG18 is a schematic diagram of the filtering position proposed in the embodiments of this application. As shown in FIG18, in forward / backward filtering, the corresponding position of the reference image corresponding to the current position (current filtering position) can be selected as the filtering input.
[0541] Considering the motion vectors of objects moving during inter-frame encoding and decoding, this application proposes that, when filtering the current position, the corresponding position of the reconstructed image / current image can be offset according to the vector information used by the coding block at the current position, such as motion vector MV or block vector BV, and the offset corresponding position and its surrounding reconstructed pixels can be used as the input of the filter.
[0542] For example, in some embodiments, Figure 19 is a schematic diagram of the filtering position proposed in the embodiments of this application. As shown in Figure 19, in forward / backward filtering, MV can be used to offset the position corresponding to the current position, that is, MV can be used to offset the filtering center position of the reference image.
[0543] Since the current image may have one or more reference images, this means that the MV may point to any of these reference images, depending on the MV used by the coding block at the current filtering position and the reference image it points to.
[0544] For example, in some embodiments, Figure 20 is a schematic diagram of the filtering position proposed in the embodiments of this application. As shown in Figure 20, in forward / backward filtering, BV can be used to offset the position corresponding to the current position, that is, BV can be used to offset the filtering center position of the current image.
[0545] When two reconstructed images are used as input, the corresponding position offset can be guided by two MV or BV.
[0546] For example, in some embodiments, Figure 21 is a schematic diagram of the filtering position proposed in the embodiments of this application. As shown in Figure 21, for bidirectional filtering or the case where two reconstructed images are used as input, the offset can be based on two MVs.
[0547] For example, in some embodiments, FIG22 is a schematic diagram of the filtering position proposed in the embodiments of this application. As shown in FIG22, for the case of bidirectional filtering as input, the offset can be based on two BVs.
[0548] For example, in some embodiments, Figure 23 is a schematic diagram of the filtering position proposed in the embodiments of this application. As shown in Figure 23, a bidirectional filter combining an Mv and a Bv may also occur.
[0549] Understandably, the loop filtering stage is performed on the reconstructed image after the current image has been reconstructed. Therefore, during temporal loop filtering, it can be determined whether the coding block at the current position has selected intra-prediction, inter-prediction, or IBC prediction. For example, in the ECM reference software, if the block at the current position belongs to an intra-prediction block, and the intraTMP prediction mode is selected, there will be one or more saved BVs in the motion buffer; if the IBC prediction mode is selected, there will also be one or more saved BVs in the motion buffer; if the inter-prediction mode is selected, there will be one or more saved MVs in the motion buffer.
[0550] For example, in some embodiments, Figure 24 is a schematic diagram of the filter proposed in the embodiments of this application. As shown in Figure 24, for unidirectional filtering, the 7x7 filter can be changed from the original 13 taps to 12 taps; Figure 25 is a schematic diagram of the filter proposed in the embodiments of this application. As shown in Figure 25, for bidirectional filtering, the two 5x5 filters are each changed from the original 7 taps to 6 taps, which is also a total of 12 taps.
[0551] Accordingly, the filtering formula for a 7x7 filter is as follows:
[0552] Where (x, y) represents the current position to be filtered; (x', y') represents the position after unidirectional MV / BV offset; (u, v) represents each filtering position under the filter window; rec represents the reconstructed pixel value of the current position to be corrected; rec' represents the reconstructed pixel value of the current position after correction; ref represents the reference image; K(a, b) is the truncation function, which restricts the range of a to between -b and b.
[0553] Accordingly, the filtering formulas for the two 5x5 filters are as follows:
[0554] Where (x', y') and (x”, y”) represent the positions of the two MV / BV offsets, respectively; ref0 and ref1 represent the two reference images.
[0555] Furthermore, in the embodiments of this application, when using vector information to assist TALF, the sequence-level syntax elements are parsed as follows:
[0556] The sequence flag `sps_talf_enabled_flag` indicates whether the current sequence can use TALF. When this syntax element is not present in the bitstream, its value is inferred to be 0. A value of 1 indicates that the current sequence can use TALF, while a value of 0 indicates that TALF cannot be used.
[0557] The syntax elements of the opening sequence are analyzed as follows:
[0558] The FIFO of the historical time-domain filter needs to be cleared when at least one of the following three conditions is true.
[0559] pcSlice->isIDRorBLA(): This condition indicates whether the current slice is IDR or BLA; IDR and BLA are both NAL types, indicating the start of a sequence; all slices in an image should have the same NAL type.
[0560] pcSlice->getPendingRasInit(): This condition indicates whether the POC has accumulated to the maximum allowed value and then been reset to 0.
[0561] pcSlice->isInterGDR(): This condition, as the name suggests, indicates whether it is a GDR.
[0562] The tAlfParamPool.clear() operation clears the FIFO of the history time-domain filter.
[0563] The `talf_reuse_flag` syntax element indicates whether the historical time-domain loop filter is reused during the current slice encoding / decoding. A value of 1 indicates reuse of the historical time-domain loop filter, while a value of 0 indicates non-reuse. When this flag is not present in the bitstream, its value is 0.
[0564] The `talf_reuse_index` syntax element represents the index of the historical time-domain loop filter FIFO used in the current slice multiplexing. Since the maximum FIFO length used in this scheme is 8, the index value can be 0, 1, 2, 3, 4, 5, 6, or 7, represented using a fixed-length code of 3 bins. When this syntax element is not present in the bitstream, its value is 0.
[0565] The value range of `talf_filter_mode` varies depending on the value of `talf_reuse_flag`. When `talf_reuse_flag` is 0, the value range of `talf_filter_mode` is 0, 1, or 2; when `talf_reuse_flag` is 1, the value range of `talf_filter_mode` is 0, 1, 2, or 3. `talf_filter_mode` of 0 indicates that the current slice will use mode 0, i.e., a one-way filter pointing to the MV indicator offset in reference image list 0; `talf_filter_mode` of 1 indicates that the current slice will use mode 1, i.e., a one-way filter pointing to the MV indicator offset in reference image list 1; `talf_filter_mode` of 2 indicates that the current slice will use mode 2, i.e., a two-way filter pointing to both MV indicator offsets in reference image list 0 and reference image list 1; `talf_filter_mode` of 3 indicates that the two inputs of the filter used when `talf_filter_mode` is 2 are swapped before filtering. Its value is 0 when this syntax element is not present in the bitstream.
[0566] `poolIdx` is an index variable representing the multiplexed FIFO, and it is related to whether the current `talf_filter_mode` is bidirectional filtering. When `talf_filter_mode` indicates bidirectional filtering, `poolIdx` is 1; otherwise, it is 0.
[0567] `talf_shift_minus6` indicates the variable precision used by one or more time-domain loop filters in the current slice encoding / decoding. It means subtracting 6 from the shift value used in the filtering. This syntax element is represented in this scheme using a fixed-length code of length 2 bins, with values of 0, 1, 2, or 3. Its value is 0 when this syntax element is not present in the bitstream.
[0568] `talf_k_order[sfIdx]` represents the exponential Golomb order used when calculating the absolute value of the sfIdx-th filter encoding / decoding coefficients in the current slice. Its value is either 0 or 1; 0 indicates the use of 0th-order exponential Golomb code, and 1 indicates the use of 1st-order exponential Golomb code. Its value is 0 when this syntax element does not exist in the bitstream.
[0569] The operation tAlfParamPool[poolIdx][0].shift = talf_shift_minus6 + 6 means restoring the parsed talf_shift_minus6 to the shift value and updating the first and second positions of the FIFO in the historical time-domain loop filter.
[0570] `talf_clip_flag[sfIdx]` indicates whether the `sfIdx`-th time-domain loop filter in the current slice uses nonlinearity. This syntax element takes the value 0 or 1; 1 indicates that the `sfIdx`-th time-domain loop filter uses nonlinearity, and 0 indicates that nonlinearity is not used. When this syntax element is not present in the bitstream, its value is 0.
[0571] `talf_clip_idx[sfIdx][j]` represents the nonlinearity index value used by the i-th coefficient of the sfIdx-th time-domain loop filter in the current slice. This syntax element takes the value 0, 1, 2, or 3. A value of 0 indicates that the input of the filter coefficient at this position does not use nonlinearity. 1, 2, and 3 represent the indices of the corresponding nonlinear truncation values, used to retrieve the truncation value from the nonlinear truncation value table. This syntax element uses a fixed-length code encoding / decoding of 2 bins. Its value is 0 if this syntax element does not exist in the bitstream.
[0572] The operation tAlfParamPool[poolIdx][0].clipIdx[sfIdx][j]=talf_clip_idx[sfIdx][j] means that the parsed talf_clip_idx value is assigned to the FIFO of the corresponding historical time-domain loop filter.
[0573] The identifiers for parsing the luminance-encoded tree blocks are as follows:
[0574] If the current slice uses a history-adaptive loop filter, the number of filters used for multiplexing is first determined.
[0575] filterCount=tAlfParamPool[poolIdx][talf_reuse_idx].filterCount,
[0576] If the current slice does not reuse the historical adaptive filter, then obtain the number of filters in the current slice.
[0577] filterCount=talf_num_filters_signalled_minus1+1
[0578] The syntax element `talf_ctb_idc[CtbAddrX][CtbAddrY]` indicates whether the luminance block of the coding tree, which is CtbAddrX in the horizontal direction and CtbAddrY in the vertical direction, uses TALF filtering. The value of `talf_ctb_idc[CtbAddrX][CtbAddrY]` ranges from 0 to `filterCount`. Its value is 0 when this syntax element is not present in the bitstream.
[0579] When reconstructing the time-domain filter coefficients, if the current slice's sh_talf_enabled_flag is 1 and talf_reuse_flag is 0, the coefficient values, shift values, and nonlinear limit values of the time-domain adaptive loop filter need to be reconstructed.
[0580] The process of obtaining the filter coefficients tAlfCoeff of the current slice is as follows:
[0581] for(sfIdx=0;sfIdx<=talf_num_filters_signalled_minus1;sfIdx++)
[0582] {
[0583] for(j=0;j <numCoeff;j++)
[0584] {
[0585] tAlfCoeff[sfIdx][j]=(talf_coeff_sign[sfIdx][j]==1)?
[0586] -talf_coeff_abs[sfIdx][j]:talf_coeff_abs[sfIdx][j]
[0587] }
[0588] }
[0589] The process of obtaining the nonlinear tAlfClip value of the current slice is as follows:
[0590] - Construct a non-linear truncation value table based on the pixel depth inputBitdepth of the luminance component.
[0591] clipTable[0] = 1 < <inputBitdepth
[0592] for(i=0;i<4;i++)
[0593] {
[0594] clipTable[i]=1<<((7-2*i+(inputBitdepth-8)))
[0595] }
[0596] - Obtain the nonlinear cutoff value for each coefficient of each filter in the current slice:
[0597] for(sfIdx=0;sfIdx<=talf_num_filters_signalled_minus1;sfIdx++)
[0598] {
[0599] for(j=0;j <numCoeff;j++)
[0600] {
[0601] tAlfClip[sfIdx][j]=clipTable[talf_clip_idx[sfIdx][j]]
[0602] }
[0603] }
[0604] The process of obtaining the shift value of the adaptive loop filter for the current slice is as follows:
[0605] shift = talf_shift_minus6 + 6
[0606] If the current slice's sh_talf_enabled_flag is 1 and talf_reuse_flag is 1, then the coefficient values, shift values, and nonlinear limit values need to be obtained from the FIFO of the historical time-domain adaptive loop filter.
[0607] The process of obtaining the filter coefficients tAlfCoeff of the current slice is as follows:
[0608] for(sfIdx=0;sfIdx<=talf_num_filters_signalled_minus1;sfIdx++)
[0609] {
[0610] for(j=0;j <numCoeff;j++)
[0611] {
[0612] tAlfCoeff[sfIdx][j]=tAlfParamPool[poolIdx][talf_reuse_idx].coeff[sfIdx][j]
[0613] }
[0614] }
[0615] The process of obtaining the nonlinear tAlfClip value of the current slice is as follows:
[0616] - Construct a non-linear truncation value table based on the pixel depth inputBitdepth of the luminance component.
[0617] clipTable[0] = 1 < <inputBitdepth
[0618] for(i=0;i<4;i++)
[0619] {
[0620] clipTable[i]=1<<((7-2*i+(inputBitdepth-8)))
[0621] }
[0622] - Obtain the nonlinear cutoff value for each coefficient of each filter in the current slice:
[0623] filterCount=tAlfParamPool[poolIdx][talf_reuse_idx].filterCount
[0624] for(sfIdx=0;sfIdx<=filterCount;sfIdx++)
[0625] {
[0626] for(j=0;j <numCoeff;j++)
[0627] {
[0628] tAlfClip[sfIdx][j]=
[0629] clipTable[tAlfParamPool[poolIdx][talf_reuse_idx].clipIdx[sfIdx][j]]
[0630] }
[0631] }
[0632] The process of obtaining the shift value of the adaptive loop filter for the current slice is as follows:
[0633] shift=tAlfParamPool[poolIdx][talf_reuse_idx].shift
[0634] When performing TALF filtering on a luminance coding tree block, TALF filtering is required if the talf_ctb_idc flag of the current luminance coding tree block is non-zero.
[0635] The inputs to the filtering process include:
[0636] 1. A reconstructed luminance image array rec after luminance adaptive loop filtering.
[0637] 2. The mode value of talf_filter_mode,
[0638] 3. Indicates the luminance coordinates (xCtb, yCtb) of the current luminance coding tree block in the current image.
[0639] 4. The width tAlfWidth and height tAlfHeight of the luminance coding tree block.
[0640] 5. The coefficients tAlfCoeff of the time-domain adaptive loop filter [][].
[0641] For each position (x, y) in the current luminance coding tree block, the value of x ranges from xCtb to xCtb+tAlfWidth-1, and the value of y ranges from yCtb to yCtb+tAlfHeight-1.
[0642] The first step is to obtain the reconstructed image and MV:
[0643] The input image of the filter is determined based on talf_filter_mode.
[0644] If talf_filter_mode is 0, then check whether the prediction block to which the current position belongs selects MV0, which points to the reference image in the reference image list 0. If it is selected, then use the reference image rec0 pointed to by MV0 as input; otherwise, skip the filtering at the current position.
[0645] If talf_filter_mode is 1, then check whether the prediction block to which the current position belongs has selected MV1 pointing to the reference image in the reference image list 1. If it is selected, then use the reference image rec1 pointed to by MV1 as input; otherwise, skip the filtering at the current position.
[0646] If talf_filter_mode is 2, it checks whether the prediction block to which the current position belongs has selected both MV0 pointing to the reference image in reference image list 0 and MV1 pointing to the reference image in reference image list 1. If selected, the reference image rec0 pointed to by MV0 and the reference image rec1 pointed to by MV1 are used as input; otherwise, the filtering at the current position is skipped.
[0647] If talf_filter_mode is 3, then it is confirmed whether the prediction block to which the current position belongs has selected both MV0 pointing to the reference image in reference image list 0 and MV1 pointing to the reference image in reference image list 1. If selected, the reference image pointed to by MV0 is used as rec1 and the reference image pointed to by MV1 is used as rec0 as input; otherwise, the filtering at the current position is skipped.
[0648] The second step is to obtain the shift value:
[0649] If MV0 and MV1 are found in the first step, then since subpixel-level precision MV is used in inter-frame prediction, the position offset on the reconstructed image pointed to by MV is obtained here by rounding to positive pixel precision.
[0650] The horizontal integer pixel offset of MV0 is:
[0651] Offset0X=MV0.Hor<0? -((abs(MV0.Hor)+8)>>4):((abs(MV0.Hor)+8)>>4)
[0652] The vertical integer pixel offset of MV0 is:
[0653] Offset0Y=MV0.Ver<0? -((abs(MV0.Ver)+8)>>4):((abs(MV0.Ver)+8)>>4)
[0654] The horizontal integer pixel offset of MV1 is:
[0655] Offset1X=MV1.Hor<0? -((abs(MV1.Hor)+8)>>4):((abs(MV1.Hor)+8)>>4)
[0656] The vertical integer pixel offset of MV1 is:
[0657] Offset1Y=MV1.Ver<0? -((abs(MV1.Ver)+8)>>4):((abs(MV1.Ver)+8)>>4)
[0658] The third step involves reconstructing the image based on the obtained positional offset, and then filtering the (x, y) position using filtering coefficients.
[0659] When talf_filter_mode is 2 or 3, and there is no skip filter at the current position:
[0660] x0=Clip3(0,picWidth,x+Offset0X)
[0661] y0=Clip3(0,picHeight,y+Offset0Y)
[0662] x1=Clip3(0,picWidth,x+Offset1X)
[0663] y1=Clip3(0,picHeight,y+Offset1Y)
[0664] sum=tAlfCoeff[filterIdx][0]*(K(rec0[x0-1][y0]-rec0[x0][y0],tAlfClip[filterIdx][0])+
[0665] K(rec0[x0+1][y0]-rec0[x0][y0],tAlfClip[filterIdx][0]))+
[0666] tAlfCoeff[filterIdx][1]*(K(rec1[x1-1][y1]-rec1[x1][y1],tAlfCip[filterIdx][1])+
[0667] K(rec1[x1+1][y1]-rec1[x1][y1],tAlfClip[filterIdx][1]))+
[0668] tAlfCoeff[filterIdx][2]*(K(rec0[x0][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][2])+
[0669] K(rec0[x0][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][2]))+
[0670] tAlfCoeff[filterIdx][3]*(K(rec1[x1][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][3])+
[0671] K(rec1[x1][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][3]))+
[0672] tAlfCoeff[filterIdx][4]*(K(rec0[x0+1][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][4])+
[0673] K(rec0[x0-1][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][4]))+
[0674] tAlfCoeff[filterIdx][5]*(K(rec1[x1+1][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][5])+
[0675] K(rec1[x1-1][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][5]))+
[0676] tAlfCoeff[filterIdx][6]*(K(rec0[x0-1][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][6])+
[0677] K(rec0[x0+1][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][6]))+
[0678] tAlfCoeff[filterIdx][7]*(K(rec1[x1-1][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][7])+
[0679] K(rec1[x1+1][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][7]))+
[0680] tAlfCoeff[filterIdx][8]*(K(rec0[x0-2][y0]-rec0[x0][y0],tAlfClip[filterIdx][8])+
[0681] K(rec0[x0+2][y0]-rec0[x0][y0],tAlfClip[filterIdx][8]))+
[0682] tAlfCoeff[filterIdx][9]*(K(rec1[x1-2][y1]-rec1[x1][y1],tAlfClip[filterIdx][9])+
[0683] K(rec1[x1+2][y1]-rec1[x1][y1],tAlfClip[filterIdx][9]))+
[0684] tAlfCoeff[filterIdx]
[0010] *(K(rec0[x0][y0-2]-rec0[x0][y0],tAlfClip[filterIdx]
[0010] )+
[0685] K(rec0[x0][y0+2]-rec0[x0][y0],tAlfClip[filterIdx]
[0010] ))+
[0686] tAlfCoeff[filterIdx]
[0011] *(K(rec1[x1][y1-2]-rec1[x1][y1],tAlfClip[filterIdx]
[0011] )+
[0687] K(rec1[x1][y1+2]-rec1[x1][y1],tAlfClip[filterIdx]
[0011] ))
[0688] signSum=sum<0?-1:1
[0689] scaledAbsSum=(abs(sum)+(1<<(shift-1)))>>shift
[0690] scaledSum=scaledAbsSum*signSum
[0691] rec’[x][y]=max(min(rec[x][y]+scaledSum,(1<<BitDepth)-1),0)
[0692] In the above calculation and filtering process, the BitDepth variable is the bit depth of the luminance component, and x and y represent the horizontal and vertical coordinates of the reconstructed image array. x0, y0, x1, and y1 are the coordinates of the center positions of rec0 and rec1 after offset, respectively. When using the reconstructed values in the arrays at coordinate positions rec0 and rec1, the horizontal coordinate should be limited to between 0 and the image width picWidth-1, and the vertical coordinate should be limited to between 0 and the image height picHeight-1. K(a, b) = min(b, max(-b, a)) is the truncation function.
[0693] When talf_filter_mode is 0 and no filtering is skipped at the current position:
[0694] x0=Clip3(0,picWidth,x+Offset0X)
[0695] y0=Clip3(0,picHeight,y+Offset0Y)
[0696] sum=tAlfCoeff[filterIdx][0]*(K(rec0[x0-1][y0]-rec0[x0][y0],tAlfClip[filterIdx][0])+
[0697] K(rec0[x0+1][y0]-rec0[x0][y0],tAlfClip[filterIdx][0]))+
[0698] tAlfCoeff[filterIdx][1]*(K(rec0[x0][y0-1]-rec0[x0][y0], tAlfClip[filterIdx][1])+
[0699] K(rec0[x0][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][1]))+
[0700] tAlfCoeff[filterIdx][2]*(K(rec0[x0+1][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][2])+
[0701] K(rec0[x0-1][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][2]))+
[0702] tAlfCoeff[filterIdx][3]*(K(rec0[x0-1][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][3])+
[0703] K(rec0[x0+1][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][3]))+
[0704] tAlfCoeff[filterIdx][4]*(K(rec0[x0-2][y0]-rec0[x0][y0],tAlfClip[filterIdx][4])+
[0705] K(rec0[x0+2][y0]-rec0[x0][y0],tAlfClip[filterIdx][4]))+
[0706] tAlfCoeff[filterIdx][5]*(K(rec0[x0][y0-2]-rec0[x0][y0],tAlfClip[filterIdx][5])+
[0707] K(rec0[x0][y0+2]-rec0[x0][y0],tAlfClip[filterIdx][5]))+
[0708] tAlfCoeff[filterIdx][6]*(K(rec0[x0-2][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][6])+
[0709] K(rec0[x0+2][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][6]))+
[0710] tAlfCoeff[filterIdx][7]*(K(rec0[x0-2][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][7])+
[0711] K(rec0[x0+2][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][7]))+
[0712] tAlfCoeff[filterIdx][8]*(K(rec0[x0-1][y0-2]-rec0[x0][y0],tAlfClip[filterIdx][8])+
[0713] K(rec0[x0+1][y0+2]-rec0[x0][y0],tAlfClip[filterIdx][8]))+
[0714] tAlfCoeff[filterIdx][9]*(K(rec0[x0-1][y0+2]-rec0[x0][y0],tAlfClip[filterIdx][9])+
[0715] K(rec0[x0+1][y0-2]-rec0[x0][y0],tAlfClip[filterIdx][9]))+
[0716] tAlfCoeff[filterIdx]
[0010] *(K(rec0[x0-3][y0]-rec0[x0][y0],tAlfClip[filterIdx]
[0010] )+
[0717] K(rec0[x0+3][y0]-rec0[x0][y0],tAlfClip[filterIdx]
[0010] ))+
[0718] tAlfCoeff[filterIdx]
[0011] *(K(rec0[x0][y0-3]-rec0[x0][y0],tAlfClip[filterIdx]
[0011] )+
[0719] K(rec0[x0][y0+3]-rec0[x0][y0],tAlfClip[filterIdx]
[0011] ))
[0720] signSum=sum<0?-1:1
[0721] scaledAbsSum=(abs(sum)+(1<<(shift-1)))>>shift
[0722] scaledSum=scaledAbsSum*signSum
[0723] rec’[x][y]=max(min(rec[x][y]+scaledSum,(1<<BitDepth)-1),0)
[0724] When talf_filter_mode is 1 and no filtering is skipped at the current position:
[0725] x1=Clip3(0,picWidth,x+Offset1X)
[0726] y1=Clip3(0,picHeight,y+Offset1Y)
[0727] sum=tAlfCoeff[filterIdx][0]*(K(rec1[x1-1][y1]-rec1[x1][y1], tAlfClip[filterIdx][0])+
[0728] K(rec1[x1+1][y1]-rec1[x1][y1],tAlfClip[filterIdx][0]))+
[0729] tAlfCoeff[filterIdx][1]*(K(rec1[x1][y1-1]-rec1[x1][y1], tAlfClip[filterIdx][1])+
[0730] K(rec1[x1][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][1]))+
[0731] tAlfCoeff[filterIdx][2]*(K(rec1[x1+1][y1-1]-rec1[x1][y1], tAlfClip[filterIdx][2])+
[0732] K(rec1[x1-1][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][2]))+
[0733] tAlfCoeff[filterIdx][3]*(K(rec1[x1-1][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][3])+
[0734] K(rec1[x1+1][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][3]))+
[0735] tAlfCoeff[filterIdx][4]*(K(rec1[x1-2][y1]-rec1[x1][y1],tAlfClip[filterIdx][4])+
[0736] K(rec1[x1+2][y1]-rec1[x1][y1],tAlfClip[filterIdx][4]))+
[0737] tAlfCoeff[filterIdx][5]*(K(rec1[x1][y1-2]-rec1[x1][y1],tAlfClip[filterIdx][5])+
[0738] K(rec1[x1][y1+2]-rec1[x1][y1],tAlfClip[filterIdx][5]))+
[0739] tAlfCoeff[filterIdx][6]*(K(rec1[x1-2][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][6])+
[0740] K(rec1[x1+2][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][6]))+
[0741] tAlfCoeff[filterIdx][7]*(K(rec1[x1-2][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][7])+
[0742] K(rec1[x1+2][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][7]))+
[0743] tAlfCoeff[filterIdx][8]*(K(rec1[x1-1][y1-2]-rec1[x1][y1],tAlfClip[filterIdx][8])+
[0744] K(rec1[x1+1][y1+2]-rec1[x1][y1],tAlfClip[filterIdx][8]))+
[0745] tAlfCoeff[filterIdx][9]*(K(rec1[x1-1][y1+2]-rec1[x1][y1],tAlfClip[filterIdx][9])+
[0746] K(rec1[x1+1][y1-2]-rec1[x1][y1],tAlfClip[filterIdx][9]))+
[0747] tAlfCoeff[filterIdx]
[0010] *(K(rec1[x1-3][y1]-rec1[x1][y1],tAlfClip[filterIdx]
[0010] )+
[0748] K(rec1[x1+3][y1]-rec1[x1][y1],tAlfClip[filterIdx]
[0010] ))+
[0749] tAlfCoeff[filterIdx]
[0011] *(K(rec1[x1][y1-3]-rec1[x1][y1],tAlfClip[filterIdx]
[0011] )+
[0750] K(rec1[x1][y1+3]-rec1[x1][y1],tAlfClip[filterIdx]
[0011] ))
[0751] signSum=sum<0?-1:1
[0752] scaledAbsSum=(abs(sum)+(1<<(shift-1)))>>shift
[0753] scaledSum=scaledAbsSum*signSum
[0754] rec’[x][y]=max(min(rec[x][y]+scaledSum,(1<<BitDepth)-1),0)
[0755] Furthermore, in the embodiments of this application, in the method of TALF filtering assisted by vector information proposed in the above embodiments, TALF has three filtering modes when the historical filter is not reused: one-way filtering when the current position has MV0 pointing to the reference image in reference image list 0, one-way filtering when the current position has MV1 pointing to the reference image in reference image list 1, and two-way filtering when the current position has both MV0 pointing to the reference image in reference image list 0 and MV1 pointing to the reference image in reference image list 1. When the historical filter is reused, there is an additional two-way filtering mode. This two-way mode also needs to find the reference position in the two reference images through MV0 and MV1, but before inputting the reconstructed value at the reference position into the filter, the inputs of the two filters of the original two-way filtering need to be swapped before performing two-way filtering.
[0756] When the slice-level identifier talf_filter_mode indicates that the current slice uses a certain mode, the CTU using TALF in the current slice will perform filtering based on whether there is a MV that meets the requirements at each position and find the reference position in the corresponding reference image.
[0757] Furthermore, based on the method of TALF filtering assisted by vector information proposed in the above embodiments, this application also proposes the following two improvements:
[0758] Firstly, this application extends a unidirectional filtering mode that can be used at all positions where inter-frame coding is used. This filtering mode uses the same filter shape as existing unidirectional filtering modes and can share a FIFO for updating historical filters with existing unidirectional filtering modes. It can also reuse the unidirectional historical filter coefficients with existing unidirectional filters.
[0759] When a filtering position belongs to a coding block that uses inter-frame coding, this position will include at least one of the reference images in reference image list 0 and reference images in reference image list 1. When this position only has MV0, the proposed new one-way filter uses the reference position offset from MV0 as input. When this position only has MV1, the proposed new one-way filter uses the reference position offset from MV1 as input. When this position has both MV0 and MV1, the proposed new one-way filter first weights the reconstructed values corresponding to the two reference positions, and then uses the weighted reconstructed value as input.
[0760] The weighting here can be done using a 1:1 ratio, or the weighting weights in the bidirectional prediction process can be determined using the BCW index saved in the motion cache, and then weighted using the weighting weights.
[0761] In this way, two new unidirectional prediction methods can be introduced: one is to use a 1:1 weighting ratio when MV0 and MV1 exist, and the other is to use the weighting of inter-frame prediction.
[0762] Secondly, regarding bidirectional prediction, the approach described in Section 2 involves directly inputting the two input signals into two filters. However, this invention proposes allowing the application of weights from inter-frame prediction before the input signals are fed into the filters. Therefore, this improvement introduces two new types of bidirectional prediction to existing methods: applying inter-frame prediction weights to the original bidirectional prediction and to bidirectional prediction with swapped inputs.
[0763] The following is an exemplary description of an implementation method for weighted processing by introducing weight values during the filtering process. This includes the process of assigning equal weights or bidirectional prediction weights to the inputs of unidirectional and bidirectional time-domain loop filters.
[0764] The syntax elements of the opening sequence are analyzed as follows:
[0765] The value range of talf_filter_mode will vary depending on the value of talf_reuse_flag. When talf_reuse_flag is 0, the value range of talf_filter_mode is 0, 1, 2, 3, 4 or 5; when talf_reuse_flag is 1, the value range of talf_filter_mode is 0, 1, 2, 3, 4, 5, 6 or 7.
[0766] A talf_filter_mode of 0 indicates that the current slice will use mode 0, which is a one-way filter that uses the offset indicated by the MV in the reference image list 0.
[0767] A talf_filter_mode of 1 indicates that the current slice will use mode 1, which is a one-way filter that uses the offset indicated by the MV in the reference image list 1.
[0768] A talf_filter_mode of 2 indicates that the current slice will use mode 2. When only MV0 pointing to reference image list 0 exists, it uses MV0 to find the offset position in reference image 0 for one-way filtering. When only MV1 pointing to reference image list 1 exists, it uses MV1 to find the offset position in reference image 1 for one-way filtering. When both MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 exist, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and uses equal weights to weight the reconstructed pixels at the two reference positions to obtain the weighted signal, and then performs one-way filtering.
[0769] `talf_filter_mode` being 3 indicates that the current slice will use mode 3. When only MV0 pointing to reference image list 0 exists, it uses MV0 to find the offset position in reference image 0 for one-way filtering. When only MV1 pointing to reference image list 1 exists, it uses MV1 to find the offset position in reference image 1 for one-way filtering. When both MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 exist, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and uses the weighting weight of inter-frame prediction to weight the reconstructed pixels at the two reference positions to obtain the weighted signal, and then performs one-way filtering.
[0770] The talf_filter_mode being 4 indicates that the current slice will use mode 4. When both MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 exist, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1, and uses the reconstructed signals at the two reference positions as inputs to the two filters of the bidirectional filter to perform bidirectional filtering.
[0771] The talf_filter_mode being 5 indicates that the current slice will use mode 5. When both MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 exist, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1. The reconstructed signals at the two reference positions are then weighted by inter-frame bidirectional prediction and used as the inputs to the two filters of bidirectional filtering for bidirectional filtering.
[0772] The talf_filter_mode being 6 indicates that the current slice will use mode 6. When both MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 exist, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1. The reconstructed signals at the two reference positions are then swapped as inputs to the two filters of the bidirectional filter for bidirectional filtering.
[0773] The talf_filter_mode being 7 indicates that the current slice will use mode 7. When both MV0 pointing to reference image list 0 and MV1 pointing to reference image list 1 exist, it uses MV0 to find reference position 0 in reference image 0 and MV1 to find reference position 1 in reference image 1. The reconstructed signals at the two reference positions are then weighted by inter-frame bidirectional prediction and their input positions are swapped. These signals are then used as the inputs to the two filters for bidirectional filtering.
[0774] When the syntax element talf_filter_mode is not present in the bitstream, its value defaults to 0.
[0775] `poolIdx` is an index variable representing the multiplexed FIFO, and it is related to whether the current `talf_filter_mode` is bidirectional filtering. When `talf_filter_mode` indicates bidirectional filtering, `poolIdx` is 1; otherwise, it is 0. Since in this implementation, bidirectional filtering is indicated when `talf_filter_mode` is 4, 5, 6, or 7, the method used to determine the variable `poolIdx` is to compare whether `talf_filter_mode` is greater than or equal to 4.
[0776] When performing TALF filtering on a luminance coding tree block, TALF filtering is required if the talf_ctb_idc flag of the current luminance coding tree block is non-zero.
[0777] The inputs to the filtering process include:
[0778] 1. A reconstructed luminance image array rec after luminance adaptive loop filtering.
[0779] 2. The mode value of talf_filter_mode,
[0780] 3. Indicates the luminance coordinates (xCtb, yCtb) of the current luminance coding tree block in the current image.
[0781] 4. The width tAlfWidth and height tAlfHeight of the luminance coding tree block.
[0782] 5. The coefficients tAlfCoeff of the time-domain adaptive loop filter [][].
[0783] For each position (x, y) in the current luminance coding tree block, the value of x ranges from xCtb to xCtb+tAlfWidth-1, and the value of y ranges from yCtb to yCtb+tAlfHeight-1.
[0784] The first step is to obtain the reconstructed image and MV:
[0785] The input image of the filter is determined based on talf_filter_mode.
[0786] If talf_filter_mode is 0, it checks whether the prediction block to which the current position belongs selects MV0, which points to the reference image in reference image list 0. If selected, the reference image rec0 pointed to by MV0 is used as input; otherwise, the filtering at the current position is skipped.
[0787] If talf_filter_mode is 1, it checks whether the prediction block at the current position has selected MV1, which points to the reference image in the reference image list 1. If it has, the reference image rec1 pointed to by MV1 is used as input; otherwise, the filtering at the current position is skipped.
[0788] If `talf_filter_mode` is 2, it checks whether the prediction block at the current position is an inter-frame prediction block. If the current block is an inter-frame prediction block and only one direction `MV0` points to reference image list 0, then the reference image `rec0` pointed to by `MV0` is used as input; if the current block is an inter-frame prediction block and only one direction `MV1` points to reference image list 1, then the reference image `rec1` pointed to by `MV1` is used as input; if the current block is an inter-frame prediction block and both one direction `MV0` points to reference image list 0 and `MV1` points to reference image list 1, then the reference images `rec0` pointed to by `MV0` and `rec1` pointed to by `MV1` are used as input, and a 1:1 weight is assigned; otherwise, filtering at the current position is skipped.
[0789] If `talf_filter_mode` is 3, it checks whether the prediction block at the current position is an inter-frame prediction block. If the current block is an inter-frame prediction block and only one direction `MV0` points to reference image list 0, then the reference image `rec0` pointed to by `MV0` is used as input; if the current block is an inter-frame prediction block and only one direction `MV1` points to reference image list 1, then the reference image `rec1` pointed to by `MV1` is used as input; if the current block is an inter-frame prediction block and both one direction `MV0` points to reference image list 0 and `MV1` points to reference image list 1, then the reference images `rec0` pointed to by `MV0` and `rec1` pointed to by `MV1` are used as input; and weights `w0:w1` are assigned, where `w0` and `w1` are the weights for bidirectional inter-frame prediction of the current block; otherwise, filtering at the current position is skipped.
[0790] If talf_filter_mode is 4, it checks whether the prediction block to which the current position belongs has selected both MV0 pointing to the reference image in reference image list 0 and MV1 pointing to the reference image in reference image list 1. If selected, the reference image rec0 pointed to by MV0 and the reference image rec1 pointed to by MV1 are used as input with a weight of 1:1. Otherwise, the filtering at the current position is skipped.
[0791] If talf_filter_mode is 5, it checks whether the prediction block to which the current position belongs has selected both MV0 pointing to the reference image in reference image list 0 and MV1 pointing to the reference image in reference image list 1. If selected, the reference image rec0 pointed to by MV0 and the reference image rec1 pointed to by MV1 are used, and the weights w0 and w1 are assigned. w0 and w1 are the weights of the bidirectional inter-frame prediction of the current block, respectively, as input. Otherwise, the filtering at the current position is skipped.
[0792] If talf_filter_mode is 6, it checks whether the prediction block to which the current position belongs has selected both MV0 pointing to the reference image in reference image list 0 and MV1 pointing to the reference image in reference image list 1. If selected, the reference image rec1 pointed to by MV0 and the reference image rec0 pointed to by MV1 are used as input with a weight of 1:1. Otherwise, the filtering at the current position is skipped.
[0793] If talf_filter_mode is 7, it checks whether the prediction block to which the current position belongs has selected both MV0 pointing to the reference image in reference image list 0 and MV1 pointing to the reference image in reference image list 1. If selected, the reference image rec1 pointed to by MV0 and the reference image rec0 pointed to by MV1 are used, and the weights w1:w0 are assigned. w1 and w0 are the weights of the bidirectional inter-frame prediction of the current block, respectively, as input. Otherwise, the filtering at the current position is skipped.
[0794] The second step is to obtain the shift value:
[0795] If MV0 and MV1 are found in the first step, then since subpixel-level precision MV is used in inter-frame prediction, the position offset on the reconstructed image pointed to by MV is obtained here by rounding to positive pixel precision.
[0796] The horizontal integer pixel offset of MV0 is:
[0797] Offset0X=MV0.Hor<0? -((abs(MV0.Hor)+8)>>4):((abs(MV0.Hor)+8)>>4)
[0798] The vertical integer pixel offset of MV0 is:
[0799] Offset0Y=MV0.Ver<0? -((abs(MV0.Ver)+8)>>4):((abs(MV0.Ver)+8)>>4)
[0800] The horizontal integer pixel offset of MV1 is:
[0801] Offset1X=MV1.Hor<0? -((abs(MV1.Hor)+8)>>4):((abs(MV1.Hor)+8)>>4)
[0802] The vertical integer pixel offset of MV1 is:
[0803] Offset1Y=MV1.Ver<0? -((abs(MV1.Ver)+8)>>4):((abs(MV1.Ver)+8)>>4)
[0804] The third step involves reconstructing the image based on the obtained positional offset, and then filtering the (x, y) position using filtering coefficients.
[0805] In the following calculation and filtering process, the BitDepth variable is the bit depth of the luminance component, and x and y represent the horizontal and vertical coordinates of the reconstructed image array. x0, y0, x1, and y1 are the coordinates of the center positions of rec0 and rec1 after offset, respectively. When using the reconstructed values in the arrays at coordinate positions rec0 and rec1, the horizontal coordinate should be limited to between 0 and the image width picWidth-1, and the vertical coordinate should be limited to between 0 and the image height picHeight-1. K(a, b) = min(b, max(-b, a)) is the truncation function for limiting the range.
[0806] talf_filter_mode is 0.
[0807] Or, talf_filter_mode is 2 and only MV0 points to rec0.
[0808] Or, talf_filter_mode is 3 and only MV0 points to rec0.
[0809] If the current position does not skip filtering:
[0810] x0=Clip3(0,picWidth,x+Offset0X)
[0811] y0=Clip3(0,picHeight,y+Offset0Y)
[0812] sum=tAlfCoeff[filterIdx][0]*(K(rec0[x0-1][y0]-rec0[x0][y0],tAlfClip[filterIdx][0])+
[0813] K(rec0[x0+1][y0]-rec0[x0][y0],tAlfClip[filterIdx][0]))+
[0814] tAlfCoeff[filterIdx][1]*(K(rec0[x0][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][1])+
[0815] K(rec0[x0][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][1]))+
[0816] tAlfCoeff[filterIdx][2]*(K(rec0[x0+1][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][2])+
[0817] K(rec0[x0-1][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][2]))+
[0818] tAlfCoeff[filterIdx][3]*(K(rec0[x0-1][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][3])+
[0819] K(rec0[x0+1][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][3]))+
[0820] tAlfCoeff[filterIdx][4]*(K(rec0[x0-2][y0]-rec0[x0][y0],tAlfClip[filterIdx][4])+
[0821] K(rec0[x0+2][y0]-rec0[x0][y0],tAlfClip[filterIdx][4]))+
[0822] tAlfCoeff[filterIdx][5]*(K(rec0[x0][y0-2]-rec0[x0][y0],tAlfClip[filterIdx][5])+
[0823] K(rec0[x0][y0+2]-rec0[x0][y0],tAlfClip[filterIdx][5]))+
[0824] tAlfCoeff[filterIdx][6]*(K(rec0[x0-2][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][6])+
[0825] K(rec0[x0+2][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][6]))+
[0826] tAlfCoeff[filterIdx][7]*(K(rec0[x0-2][y0+1]-rec0[x0][y0],tAlfClip[filterIdx][7])+
[0827] K(rec0[x0+2][y0-1]-rec0[x0][y0],tAlfClip[filterIdx][7]))+
[0828] tAlfCoeff[filterIdx][8]*(K(rec0[x0-1][y0-2]-rec0[x0][y0],tAlfClip[filterIdx][8])+
[0829] K(rec0[x0+1][y0+2]-rec0[x0][y0],tAlfClip[filterIdx][8]))+
[0830] tAlfCoeff[filterIdx][9]*(K(rec0[x0-1][y0+2]-rec0[x0][y0],tAlfClip[filterIdx][9])+
[0831] K(rec0[x0+1][y0-2]-rec0[x0][y0],tAlfClip[filterIdx][9]))+
[0832] tAlfCoeff[filterIdx]
[0010] *(K(rec0[x0-3][y0]-rec0[x0][y0],tAlfClip[filterIdx]
[0010] )+
[0833] K(rec0[x0+3][y0]-rec0[x0][y0],tAlfClip[filterIdx]
[0010] ))+
[0834] tAlfCoeff[filterIdx]
[0011] *(K(rec0[x0][y0-3]-rec0[x0][y0], tAlfClip[filterIdx]
[0011] )+
[0835] K(rec0[x0][y0+3]-rec0[x0][y0],tAlfClip[filterIdx]
[0011] ))
[0836] signSum = sum < 0? -1:1
[0837] scaledAbsSum=(abs(sum)+(1<<(shift-1)))>>shift
[0838] scaledSum=scaledAbsSum*signSum
[0839] rec'[x][y]=max(min(rec[x][y]+scaledSum, (1< <BitDepth)-1),0)
[0840] talf_filter_mode is 1.
[0841] Or, talf_filter_mode is 2 and only MV1 points to rec1.
[0842] Or, if talf_filter_mode is 3 and only MV1 points to rec1,
[0843] If the current position does not skip filtering:
[0844] x1=Clip3(0,picWidth,x+Offset1X)
[0845] y1=Clip3(0,picHeight,y+Offset1Y)
[0846] sum=tAlfCoeff[filterIdx][0]*(K(rec1[x1-1][y1]-rec1[x1][y1], tAlfClip[filterIdx][0])+
[0847] K(rec1[x1+1][y1]-rec1[x1][y1],tAlfClip[filterIdx][0]))+
[0848] tAlfCoeff[filterIdx][1]*(K(rec1[x1][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][1])+
[0849] K(rec1[x1][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][1]))+
[0850] tAlfCoeff[filterIdx][2]*(K(rec1[x1+1][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][2])+
[0851] K(rec1[x1-1][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][2]))+
[0852] tAlfCoeff[filterIdx][3]*(K(rec1[x1-1][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][3])+
[0853] K(rec1[x1+1][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][3]))+
[0854] tAlfCoeff[filterIdx][4]*(K(rec1[x1-2][y1]-rec1[x1][y1],tAlfClip[filterIdx][4])+
[0855] K(rec1[x1+2][y1]-rec1[x1][y1],tAlfClip[filterIdx][4]))+
[0856] tAlfCoeff[filterIdx][5]*(K(rec1[x1][y1-2]-rec1[x1][y1],tAlfClip[filterIdx][5])+
[0857] K(rec1[x1][y1+2]-rec1[x1][y1],tAlfClip[filterIdx][5]))+
[0858] tAlfCoeff[filterIdx][6]*(K(rec1[x1-2][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][6])+
[0859] K(rec1[x1+2][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][6]))+
[0860] tAlfCoeff[filterIdx][7]*(K(rec1[x1-2][y1+1]-rec1[x1][y1],tAlfClip[filterIdx][7])+
[0861] K(rec1[x1+2][y1-1]-rec1[x1][y1],tAlfClip[filterIdx][7]))+
[0862] tAlfCoeff[filterIdx][8]*(K(rec1[x1-1][y1-2]-rec1[x1][y1],tAlfClip[filterIdx][8])+
[0863] K(rec1[x1+1][y1+2]-rec1[x1][y1],tAlfClip[filterIdx][8]))+
[0864] tAlfCoeff[filterIdx][9]*(K(rec1[x1-1][y1+2]-rec1[x1][y1],tAlfClip[filterIdx][9])+
[0865] K(rec1[x1+1][y1-2]-rec1[x1][y1],tAlfClip[filterIdx][9]))+
[0866] tAlfCoeff[filterIdx]
[0010] *(K(rec1[x1-3][y1]-rec1[x1][y1],tAlfClip[filterIdx]
[0010] )+
[0867] K(rec1[x1+3][y1]-rec1[x1][y1],tAlfClip[filterIdx]
[0010] ))+
[0868] tAlfCoeff[filterIdx]
[0011] *(K(rec1[x1][y1-3]-rec1[x1][y1], tAlfClip[filterIdx]
[0011] )+
[0869] K(rec1[x1][y1+3]-rec1[x1][y1],tAlfClip[filterIdx]
[0011] ))
[0870] signSum = sum < 0? -1:1
[0871] scaledAbsSum=(abs(sum)+(1<<(shift-1)))>>shift
[0872] scaledSum=scaledAbsSum*signSum
[0873] rec'[x][y]=max(min(rec[x][y]+scaledSum, (1< <BitDepth)-1),0)
[0874] talf_filter_mode is 2 or 3.
[0875] And when MV0 and MV1 exist simultaneously,
[0876] If the current position does not skip filtering:
[0877] x0=Clip3(0,picWidth,x+Offset0X)
[0878] y0=Clip3(0,picHeight,y+Offset0Y)
[0879] x1=Clip3(0,picWidth,x+Offset1X)
[0880] y1=Clip3(0,picHeight,y+Offset1Y)
[0881] Get the weighted filter input array recW:
[0882] If talf_filter_mode is 2, then a 1:1 weight is assigned.
[0883] recW[u][j]=(rec0[x0+u][y0+j]+rec1[x1+u][y1+j])>>1,
[0884] If talf_filter_mode is 3, then bidirectional prediction weights w0 and w1 are assigned.
[0885] recW[u][j]=(rec0[x0+u][y0+j]*w0+rec1[x1+u][y1+j]*w1)>>3
[0886] u and j represent the positions within the unidirectional filtering window.
[0887] Use recW as the input for a one-way filter:
[0888] sum=tAlfCoeff[filterIdx][0]*(K(recW[1][0]-recW[0][0], tAlfClip[filterIdx][0])+
[0889] K(recW[-1][0]-recW[0][0],tAlfClip[filterIdx][0]))+
[0890] tAlfCoeff[filterIdx][1]*(K(recW[0][-1]-recW[0][0], tAlfClip[filterIdx][1])+
[0891] K(recW[0][1]-recW[0][0],tAlfClip[filterIdx][1]))+
[0892] tAlfCoeff[filterIdx][2]*(K(recW[-1][1]-recW[0][0], tAlfClip[filterIdx][2])+
[0893] K(recW[1][-1]-recW[0][0],tAlfClip[filterIdx][2]))+
[0894] tAlfCoeff[filterIdx][3]*(K(recW[-1][-1]-recW[0][0], tAlfClip[filterIdx][3])+
[0895] K(recW[1][1]-recW[0][0],tAlfClip[filterIdx][3]))+
[0896] tAlfCoeff[filterIdx][4]*(K(recW[-2][0]-recW[0][0],tAlfClip[filterIdx][4])+
[0897] K(recW[2][0]-recW[0][0],tAlfClip[filterIdx][4]))+
[0898] tAlfCoeff[filterIdx][5]*(K(recW[0][-2]-recW[0][0],tAlfClip[filterIdx][5])+
[0899] K(recW[0][2]-recW[0][0],tAlfClip[filterIdx][5]))+
[0900] tAlfCoeff[filterIdx][6]*(K(recW[-2][-1]-recW[0][0],tAlfClip[filterIdx][6])+
[0901] K(rec1[2][1]-rec1[0][0],tAlfClip[filterIdx][6]))+
[0902] tAlfCoeff[filterIdx][7]*(K(rec1[-2][1]-rec1[0][0],tAlfClip[filterIdx][7])+
[0903] K(rec1[2][-1]-rec1[0][0],tAlfClip[filterIdx][7]))+
[0904] tAlfCoeff[filterIdx][8]*(K(rec1[-1][-2]-rec1[0][0],tAlfClip[filterIdx][8])+
[0905] K(rec1[1][2]-rec1[0][0],tAlfClip[filterIdx][8]))+
[0906] tAlfCoeff[filterIdx][9]*(K(rec1[-1][2]-rec1[0][0],tAlfClip[filterIdx][9])+
[0907] K(rec1[1][-2]-rec1[0][0],tAlfClip[filterIdx][9]))+
[0908] tAlfCoeff[filterIdx]
[0010] *(K(rec1[-3][0]-rec1[0][0], tAlfClip[filterIdx]
[0010] )+
[0909] K(rec1[3][0]-rec1[0][0],tAlfClip[filterIdx]
[0010] ))+
[0910] tAlfCoeff[filterIdx]
[0011] *(K(rec1[0][-3]-rec1[0][0], tAlfClip[filterIdx]
[0011] )+
[0911] K(rec1[0][3]-rec1[0][0],tAlfClip[filterIdx]
[0011] ))
[0912] signSum = sum < 0? -1:1
[0913] scaledAbsSum=(abs(sum)+(1<<(shift-1)))>>shift
[0914] scaledSum=scaledAbsSum*signSum
[0915] rec'[x][y]=max(min(rec[x][y]+scaledSum, (1< <BitDepth)-1),0)
[0916] talf_filter_mode is 4, 5, 6, or 7.
[0917] If the current position does not skip filtering:
[0918] x0=Clip3(0,picWidth,x+Offset0X)
[0919] y0=Clip3(0,picHeight,y+Offset0Y)
[0920] x1=Clip3(0,picWidth,x+Offset1X)
[0921] y1=Clip3(0,picHeight,y+Offset1Y)
[0922] When talf_filter_mode is 4 or 6, w0 and w1 are 4; when talf_filter_mode is 5, w0 and w1 are inter-frame predictions.
[0923] The weighted weights are calculated based on the time. When talf_filter_mode is 7, w0 and w1 are the weights of their swapped mode 5.
[0924] sum =
[0925] tAlfCoeff[filterIdx][0]*(K(((rec0[x0-1][y0]-rec0[x0][y0])*w0)>>2,tAlfClip[filterIdx][0])+
[0926] K(((rec0[x0+1][y0]-rec0[x0][y0])*w0)>>2,tAlfClip[filterIdx][0]))+
[0927] tAlfCoeff[filterIdx][1]*(K(((rec1[x1-1][y1]-rec1[x1][y1])*w1)>>2,tAlfCip[filterIdx][1])+
[0928] K(((rec1[x1+1][y1]-rec1[x1][y1])*w1)>>2,tAlfClip[filterIdx][1]))+
[0929] tAlfCoeff[filterIdx][2]*(K(((rec0[x0][y0-1]-rec0[x0][y0])*w0)>>2,tAlfClip[filterIdx][2])+
[0930] K(((rec0[x0][y0+1]-rec0[x0][y0])*w0)>>2,tAlfClip[filterIdx][2]))+
[0931] tAlfCoeff[filterIdx][3]*(K(((rec1[x1][y1-1]-rec1[x1][y1])*w1)>>2,tAlfClip[filterIdx][3])+
[0932] K(((rec1[x1][y1+1]-rec1[x1][y1])*w1)>>2,tAlfClip[filterIdx][3]))+
[0933] tAlfCoeff[filterIdx][4]*(K(((rec0[x0+1][y0-1]-rec0[x0][y0])*w0)>>2,tAlfClip[filterIdx][4])+
[0934] K(((rec0[x0-1][y0+1]-rec0[x0][y0])*w0)>>2,tAlfClip[filterIdx][4]))+
[0935] tAlfCoeff[filterIdx][5]*(K(((rec1[x1+1][y1-1]-rec1[x1][y1])*w1)>>2,tAlfClip[filterIdx][5])+
[0936] K(((rec1[x1-1][y1+1]-rec1[x1][y1])*w1)>>2,tAlfClip[filterIdx][5]))+
[0937] tAlfCoeff[filterIdx][6]*(K(((rec0[x0-1][y0-1]-rec0[x0][y0]*w0)>>2,tAlfClip[filterIdx][6])+
[0938] K(((rec0[x0+1][y0+1]-rec0[x0][y0])*w0)>>2,tAlfClip[filterIdx][6]))+
[0939] tAlfCoeff[filterIdx][7]*(K(((rec1[x1-1][y1-1]-rec1[x1][y1])*w1)>>2,tAlfClip[filterIdx][7])+
[0940] K(((rec1[x1+1][y1+1]-rec1[x1][y1]*w1)>>2,tAlfClip[filterIdx][7]))+
[0941] tAlfCoeff[filterIdx][8]*(K(rec0[x0-2][y0]-rec0[x0][y0]*w0)>>2,tAlfClip[filterIdx][8])+
[0942] K(rec0[x0+2][y0]-rec0[x0][y0]*w0)>>2,tAlfClip[filterIdx][8]))+
[0943] tAlfCoeff[filterIdx][9]*(K(((rec1[x1-2][y1]-rec1[x1][y1]*w1)>>2,tAlfClip[filterIdx][9])+
[0944] K(((rec1[x1+2][y1]-rec1[x1][y1]*w1)>>2,tAlfClip[filterIdx][9]))+
[0945] tAlfCoeff[filterIdx]
[0010] *(K(rec0[x0][y0-2]-rec0[x0][y0]*w0)>>2,tAlfClip[filterIdx]
[0010] )+
[0946] K(rec0[x0][y0+2]-rec0[x0][y0]*w0)>>2,tAlfClip[filterIdx]
[0010] ))+
[0947] tAlfCoeff[filterIdx]
[0011] *(K(((rec1[x1][y1-2]-rec1[x1][y1]*w1)>>2,tAlfClip[filterIdx]
[0011] )+
[0948] K(((rec1[x1][y1+2]-rec1[x1][y1]*w1)>>2,tAlfClip[filterIdx]
[0011] ))
[0949] signSum=sum<0?-1:1
[0950] scaledAbsSum=(abs(sum)+(1<<(shift-1)))>>shift
[0951] scaledSum=scaledAbsSum*signSum
[0952] rec'[x][y]=max(min(rec[x][y]+scaledSum, (1< <BitDepth)-1),0)
[0953] In the encoding and decoding method proposed in the embodiments of this application, the methods of imparting equal weights to unidirectional or bidirectional filtering and imparting bidirectional prediction weights to unidirectional or bidirectional filtering can correspond to the filtering modes when talf_filter_mode is 2, 3, 4, 5, 6, and 7, respectively.
[0954] It is understood that in the embodiments of this application, the value of talf_filter_mode is not limited to 0-7. For example, talf_filter_mode can be 0, 1, 2, 3, 4, 5, which corresponds to 6 filtering modes. For these 6 filtering modes, the weighted one-way or two-way filtering proposed in this application can also be used. This application does not make any specific limitations.
[0955] Furthermore, in the embodiments of this application, since there is only one reference image list and only one-way prediction can be used for a frame during unidirectional inter-frame prediction (P-frame), the temporal adaptive loop filter should only have talf_filter_mode 0 during P-frame, and other modes are not applicable to P-frame. Therefore, when the current slice uses temporal adaptive loop filtering during P-frame, the value of talf_filter_mode does not need to be parsed, but its default value is directly zero.
[0956] Accordingly, in the embodiments of this application, parsing talf_filter_mode can be based on the current inter-frame coded slice being a B-slice.
[0957] For example, in some embodiments, a variable can be used to indicate whether it is a B-slice, such as isInterBSlice, that is, isInterBSlice can be a variable for determining whether the current slice is a bidirectional prediction slice.
[0958] In other words, in the embodiments of this application, the parsing of the syntax element talf_filter_mode can depend on the value of the variable isInterBSlice.
[0959] Furthermore, in the embodiments of this application, temporal adaptive loop filtering is a technique implemented on inter-frame coded frames, so it can be chosen not to use temporal adaptive loop filtering for intra-frame coded frames. Accordingly, a variable can be used to indicate whether it is a non-intra-coded slice, for example, isIntraSlice, that is, isIntraSlice can be a variable to determine whether the current slice is a non-intra-coded slice.
[0960] In other words, in the embodiments of this application, the parsing of the syntax element sh_talf_enabled_flag can depend on the value of the variable isIntraSlice.
[0961] For example, in some embodiments, the title sequence syntax elements are parsed as follows:
[0962] Among them, isIntraSlice is a variable used to determine whether the current slice is an intra-coded slice, and isInterBSlice is a variable used to determine whether the current slice is a bidirectional prediction slice.
[0963] Therefore, the encoding / decoding method proposed in the embodiments of this application can use equal weighting or inter-frame prediction weighting to weight the input values of the two reference positions at the bidirectional inter-frame prediction positions, and use them as inputs for unidirectional temporal adaptive loop filtering. Alternatively, equal weighting or inter-frame prediction weighting can be used to assign weights to the two inputs of the bidirectional adaptive loop filtering, and then implement bidirectional adaptive loop filtering.
[0964] In other words, the encoding / decoding method proposed in this application, during the process of TALF filtering assisted by vector information, can further introduce corresponding weights for the reference positions after obtaining the reference positions using motion vectors or block vectors, and perform weighted calculations based on the reference positions and corresponding weights to complete the TALF filtering of the sample positions. The introduction of weights and weighted processing can, on the one hand, provide filtering modes applicable to more filtering scenarios, and on the other hand, improve the accuracy of the TALF filtering input information, thereby further improving the filtering effect and enhancing encoding / decoding performance.
[0965] This application provides an encoding / decoding method. During TALF filtering, a reference position can be obtained by combining filtering modes and using vector information, including motion vectors or block vectors, corresponding to the sample position. Simultaneously, TALF filtering of the sample position is performed based on the reference position within the corresponding filtering mode. For one or more filtering modes, weights can be introduced during the filtering process for weighted averaging. In other words, this application introduces vector information to assist TALF filtering by combining the weights determined by the filtering mode, thereby further improving the filtering effect and enhancing encoding / decoding performance.
[0966] In another embodiment of this application, based on the same inventive concept as the foregoing embodiments, referring to FIG26, a schematic diagram of the composition structure of the encoder 210 proposed in this application embodiment is shown. As shown in FIG26, the encoder 210 may include: a first determining unit 2101; wherein,
[0967] The first determining unit 2101 is configured to, when filtering the current image using TALF, determine filter coefficients and a filtering mode; determine at least one reference position corresponding to the current position based on the filtering mode and vector information corresponding to the current position; and perform filtering based on the filtering mode, the reconstructed samples of the at least one reference position, and the filter coefficients to determine the filtered reconstructed value of the current position.
[0968] It should be noted that, in the embodiments of this application, encoder 210 can also be regarded as a data processing mode (or "entropy encoder"), used to encode the values of the syntax elements to be encoded.
[0969] Understandably, in the embodiments of this application, a "unit" can be a portion of a circuit, a portion of a processor, a portion of a program or software, etc., and can also be a module or a non-modular component. Furthermore, the components in this embodiment 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 described above can be implemented in hardware or as a software functional module.
[0970] If the integrated un...
Claims
A decoding method applied to a decoder, the method comprising: in a case where it is determined that a current picture is filtered using temporal adaptive loop filtering (TALF), determining filter coefficients and a filter mode; determining at least one reference position corresponding to a current position according to the filter mode and vector information corresponding to the current position; filtering based on the filter mode, reconstructed samples of the at least one reference position and the filter coefficients to determine a filtered reconstructed value of the current position. The method of claim 1, wherein, The vector information corresponding to the current position comprises at least one motion vector corresponding to the current position, and the determining the at least one reference position corresponding to the current position according to the filter mode and the vector information corresponding to the current position comprises: determining at least one inter-frame reference picture corresponding to the current picture according to the filter mode and the at least one motion vector; in a case where the at least one inter-frame reference picture exists in a reference picture list corresponding to the current picture, determining the at least one reference position corresponding to the current position in the at least one inter-frame reference picture according to the at least one motion vector. The method of claim 2, wherein, The filter mode comprises one or more of a first mode, a second mode, a third mode, a fourth mode, a fifth mode, a sixth mode, a seventh mode and an eighth mode. The method of claim 3, wherein, The determining the at least one reference position corresponding to the current position in the at least one inter-frame reference picture according to the at least one motion vector based on the filter mode comprises: in a case where the filter mode satisfies a first condition, determining a first position offset value in a first direction and a second position offset value in a second direction according to a first motion vector; determining a first reference position in a first inter-frame reference picture according to the first position offset value and the second position offset value; wherein the first condition comprises one or more of the following: the filter mode is the first mode; the filter mode is the third mode, and only the first motion vector exists; the filter mode is the fourth mode, and only the first motion vector exists. The method of claim 4, wherein, The filtering based on the filter mode, the reconstructed samples of the at least one reference position and the filter coefficients to determine the filtered reconstructed value of the current position comprises: in a case where the filter mode satisfies the first condition, determining a reconstructed sample value of the current position and a reconstructed sample value of the first reference position; determining the filtered reconstructed value of the current position according to the filter coefficients, the reconstructed sample value of the current position and the reconstructed sample value of the first reference position. The method of claim 3, wherein, The determining the at least one reference position corresponding to the current position in the at least one inter-frame reference picture according to the at least one motion vector based on the filter mode comprises: in a case where the filter mode satisfies a second condition, determining a third position offset value in a first direction and a fourth position offset value in a second direction according to a second motion vector; determining a second reference position in a second inter-coded picture according to the first position offset value and the second position offset value; wherein the second condition comprises at least one or more of: the filter mode is the second mode; the filter mode is the third mode, and only the second motion vector exists; the filter mode is the fourth mode, and only the second motion vector exists. The method of claim 6, wherein, the filtering based on the filter mode, the reconstructed samples of the at least one reference position, and the filter coefficients to determine the filtered reconstructed value of the current position comprises: in a case that the filter mode satisfies the second condition, determining the reconstructed sample value of the current position and the reconstructed sample value of the second reference position; determining the filtered reconstructed value of the current position according to the filter coefficients, the reconstructed sample value of the current position, and the reconstructed sample value of the second reference position. The method of claim 3, wherein, the determining the at least one reference position corresponding to the current position in the at least one inter-coded picture according to the filter mode and the at least one motion vector comprises: in a case that the filter mode satisfies a third condition, determining a first position offset value in a first direction and a second position offset value in a second direction according to a first motion vector, and determining a third position offset value in the first direction and a fourth position offset value in the second direction according to a second motion vector; determining a first reference position in a first inter-coded picture according to the first position offset value and the second position offset value; determining a second reference position in a second inter-coded picture according to the third position offset value and the fourth position offset value; wherein the third condition comprises at least one or more of: the filter mode is the third mode, and the first motion vector and the second motion vector exist; the filter mode is the fourth mode, and the first motion vector and the second motion vector exist; the filter mode is the fifth mode; the filter mode is the sixth mode; the filter mode is the seventh mode; the filter mode is the eighth mode. The method of claim 6, wherein, the filtering based on the filter mode, the reconstructed samples of the at least one reference position, and the filter coefficients to determine the filtered reconstructed value of the current position comprises: in a case that the filter mode is the third mode, or the fourth mode, or the sixth mode, or the eighth mode, determining a first weight corresponding to the first reference position and a second weight corresponding to the second reference position according to the filter mode; determining the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, and the reconstructed sample value of the second reference position; determining the filtered reconstructed value of the current position according to the filtering based on the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, the first weight, the reconstructed sample value of the second reference position, the second weight, and the filter coefficients. The method of claim 9, wherein, The determining the first weight corresponding to the first reference position and the second weight corresponding to the second reference position according to the filter mode comprises: In a case where the filter mode is the third mode, the first weight and the second weight are set as preset values. The method of claim 9, wherein, The determining the first weight corresponding to the first reference position and the second weight corresponding to the second reference position according to the filter mode comprises: In a case where the filter mode is the fourth mode, or the sixth mode, or the eighth mode, a first inter-frame prediction weight corresponding to the first reference position and a second inter-frame prediction weight corresponding to the second reference position are determined; The first weight is determined according to the first inter-frame prediction weight, and the second weight is determined according to the second inter-frame prediction weight. The method of claim 9, wherein, The filtering according to the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, the first weight, the reconstructed sample value of the second reference position, the second weight and the filter coefficient to determine the filtered reconstructed value of the current position comprises: In a case where the filter mode is the third mode, or the fourth mode, weighted sample values are determined according to the reconstructed sample value of the first reference position, the reconstructed sample value of the second reference position, the first weight and the second weight; The filtering according to the reconstructed sample value of the current position, the weighted sample value and the filter coefficient to determine the filtered reconstructed value of the current position. The method of claim 9, wherein, The filtering according to the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, the first weight, the reconstructed sample value of the second reference position, the second weight and the filter coefficient to determine the filtered reconstructed value of the current position comprises: In a case where the filter mode is the sixth mode, a weighted sample value corresponding to the first reference position is determined according to the reconstructed sample value of the first reference position and the first weight, and a weighted sample value corresponding to the second reference position is determined according to the reconstructed sample value of the second reference position and the second weight; The filtering according to the reconstructed sample value of the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position and the filter coefficient to determine the filtered reconstructed value of the current position. The method of claim 9, wherein, The filtering according to the reconstructed sample value of the current position, the reconstructed sample of the first reference position, the first weight, the reconstructed sample of the second reference position, the second weight and the filter coefficient to determine the filtered reconstructed value of the current position comprises: In a case where the filter mode is the eighth mode, a weighted sample value corresponding to the second reference position is determined according to the reconstructed sample value of the first reference position and the first weight, and a weighted sample value corresponding to the first reference position is determined according to the reconstructed sample value of the second reference position and the second weight; filtering the reconstructed sample value of the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position, and the filter coefficient, to determine the filtered reconstructed value of the current position. The method of claim 6, wherein, The filtering based on the filter mode, the reconstructed sample of the at least one reference position, and the filter coefficient to determine the filtered reconstructed value of the current position includes: In a case where the filter mode is the fifth mode or the seventh mode, determining the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, and the reconstructed sample value of the second reference position; filtering the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, the reconstructed sample value of the second reference position, and the filter coefficient, to determine the filtered reconstructed value of the current position. The method further includes: The method of any one of claims 4-15, wherein, In a case where the at least one inter-frame reference image does not exist in the reference image list corresponding to the current image, skipping the TALF filtering of the current position. The vector information corresponding to the current position includes at least one block vector corresponding to the current position, and the determining the at least one reference position corresponding to the current position according to the filter mode and the vector information corresponding to the current position includes: The method of claim 3, wherein, determining the at least one reference position corresponding to the current position in the current image according to the filter mode and the at least one block vector. The method further includes: The method of any one of claims 1-4, wherein decoding the code stream to determine auxiliary filter identification information; in a case where it is determined based on the auxiliary filter identification information that the vector information is used to assist the TALF filtering, performing the determining process of the at least one reference position. The method further includes: The method of claim 18, wherein, in a case where it is determined based on the auxiliary filter identification information that the vector information is not used to assist the TALF filtering, determining at least one homologous position corresponding to the current position in the at least one inter-frame reference image corresponding to the current image; filtering based on the reconstructed sample of the at least one homologous position and the filter coefficient to determine the filtered reconstructed value of the current position. An encoding method applied to an encoder, the method including: when filtering using TALF on a current image, determining a filter coefficient; determining at least one reference position corresponding to the current position according to the filter mode and vector information corresponding to the current position; filtering based on the filter mode, the reconstructed sample of the at least one reference position, and the filter coefficient to determine the filtered reconstructed value of the current position. The vector information corresponding to the current position includes at least one motion vector corresponding to the current position, and the determining the at least one reference position corresponding to the current position according to the filter mode and the vector information corresponding to the current position includes: The method of claim 20, wherein, determining at least one inter-frame reference image corresponding to the current image according to the filter mode and the at least one motion vector; In a case where the at least one inter-coded reference picture exists in the reference picture list corresponding to the current picture, the at least one reference position corresponding to the current position is determined in the at least one inter-coded reference picture according to the at least one motion vector. The method of claim 21, wherein, The filter mode comprises one or more of a first mode, a second mode, a third mode, a fourth mode, a fifth mode, a sixth mode, a seventh mode, and an eighth mode. The method of claim 22, wherein, The determining the at least one reference position corresponding to the current position in the at least one inter-coded reference picture according to the at least one motion vector based on the filter mode comprises: In a case where the filter mode satisfies a first condition, determining a first position offset value in a first direction and a second position offset value in a second direction according to a first motion vector; determining a first reference position in a first inter-coded reference picture according to the first position offset value and the second position offset value; The first condition comprises one or more of the following: The filter mode is the first mode; The filter mode is the third mode, and only the first motion vector exists; The filter mode is the fourth mode, and only the first motion vector exists. The method of claim 23, wherein, The filtering based on the filter mode, the reconstructed samples of the at least one reference position, and the filter coefficients to determine the filtered reconstructed value of the current position comprises: In a case where the filter mode satisfies the first condition, determining a reconstructed sample value of the current position and a reconstructed sample value of the first reference position; determining the filtered reconstructed value of the current position according to the filter coefficients, the reconstructed sample value of the current position, and the reconstructed sample value of the first reference position. The method of claim 22, wherein, The determining the at least one reference position corresponding to the current position in the at least one inter-coded reference picture according to the at least one motion vector based on the filter mode comprises: In a case where the filter mode satisfies a second condition, determining a third position offset value in a first direction and a fourth position offset value in a second direction according to a second motion vector; determining a second reference position in a second inter-coded reference picture according to the third position offset value and the fourth position offset value; The second condition comprises one or more of the following: The filter mode is the second mode; The filter mode is the third mode, and only the second motion vector exists; The filter mode is the fourth mode, and only the second motion vector exists. The filtering based on the filter mode, the reconstructed samples of the at least The method of claim 25, wherein, one reference position, and the filter coefficients to determine the filtered reconstructed value of the current position comprises: in a case where the filter mode satisfies the second condition, determining a reconstructed sample value of the current position and a reconstructed sample value of the second reference position; determining the filtered reconstructed value of the current position according to the filter coefficients and the reconstructed sample value of the current position and the reconstructed sample value of the second reference position. The method of claim 22, wherein, The determining the at least one reference position corresponding to the current position in the at least one inter-frame reference image according to the at least one motion vector based on the filter mode comprises: In a case where the filter mode satisfies a third condition, determining a first position offset value in a first direction and a second position offset value in a second direction according to a first motion vector, and determining a third position offset value in the first direction and a fourth position offset value in the second direction according to a second motion vector; Determining a first reference position in a first inter-frame reference image according to the first position offset value and the second position offset value, and determining a second reference position in a second inter-frame reference image according to the third position offset value and the fourth position offset value; The third condition comprises at least one of the following: The filter mode is the third mode, and the first motion vector and the second motion vector exist; The filter mode is the fourth mode, and the first motion vector and the second motion vector exist; The filter mode is the fifth mode; The filter mode is the sixth mode; The filter mode is the seventh mode; The filter mode is the eighth mode. The method of claim 25, wherein, The filtering based on the filter mode, the reconstructed samples of the at least one reference position and the filter coefficients to determine the filtered reconstructed value of the current position comprises: In a case where the filter mode is the third mode, or the fourth mode, or the sixth mode, or the eighth mode, determining a first weight corresponding to the first reference position and a second weight corresponding to the second reference position according to the filter mode; Determining a reconstructed sample value of the current position, a reconstructed sample value of the first reference position and a reconstructed sample value of the second reference position; Filtering based on the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, the first weight, the reconstructed sample value of the second reference position, the second weight and the filter coefficients to determine the filtered reconstructed value of the current position. The method of claim 28, wherein, The determining the first weight corresponding to the first reference position and the second weight corresponding to the second reference position according to the filter mode comprises: In a case where the filter mode is the third mode, setting the first weight and the second weight as preset values. The method of claim 28, wherein, The determining the first weight corresponding to the first reference position and the second weight corresponding to the second reference position according to the filter mode comprises: In a case where the filter mode is the fourth mode, or the sixth mode, or the eighth mode, determining a first inter-frame prediction weight corresponding to the first reference position and a second inter-frame prediction weight corresponding to the second reference position; Determining the first weight according to the first inter-frame prediction weight, and determining the second weight according to the second inter-frame prediction weight. The method of claim 28, wherein, The filtering according to the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, the first weight, the reconstructed sample value of the second reference position, the second weight and the filter coefficient determines the filtered reconstructed value of the current position, including: In the case of the filtering mode being the third mode or the fourth mode, the weighted sample value is determined according to the reconstructed sample value of the first reference position, the reconstructed sample value of the second reference position, the first weight and the second weight. The filtering according to the reconstructed sample value of the current position, the weighted sample value and the filter coefficient determines the filtered reconstructed value of the current position. The filtering according to the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, the first weight, the reconstructed sample value of the second reference position, the second weight and the filter coefficient determines the filtered reconstructed value of the current position, including: The method of claim 28, wherein, In the case of the filtering mode being the sixth mode, the weighted sample value corresponding to the first reference position is determined according to the reconstructed sample value of the first reference position and the first weight, and the weighted sample value corresponding to the second reference position is determined according to the reconstructed sample value of the second reference position and the second weight. The filtering according to the reconstructed sample value of the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position and the filter coefficient determines the filtered reconstructed value of the current position. The filtering according to the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, the first weight, the reconstructed sample value of the second reference position, the second weight and the filter coefficient determines the filtered reconstructed value of the current position, including: The method of claim 28, wherein, In the case of the filtering mode being the eighth mode, the weighted sample value corresponding to the second reference position is determined according to the reconstructed sample value of the first reference position and the first weight, and the weighted sample value corresponding to the first reference position is determined according to the reconstructed sample value of the second reference position and the second weight. The filtering according to the reconstructed sample value of the current position, the weighted sample value corresponding to the first reference position, the weighted sample value corresponding to the second reference position and the filter coefficient determines the filtered reconstructed value of the current position. The filtering based on the filtering mode, the reconstructed sample of the at least one reference position and the filter coefficient determines the filtered reconstructed value of the current position, including: The method of claim 25, wherein, In the case of the filtering mode being the fifth mode or the seventh mode, the reconstructed sample value of the current position, the reconstructed sample value of the first reference position and the reconstructed sample value of the second reference position are determined. The filtering according to the reconstructed sample value of the current position, the reconstructed sample value of the first reference position, the reconstructed sample value of the second reference position and the filter coefficient determines the filtered reconstructed value of the current position. The method further includes: The method of any one of claims 20-34, wherein determine a cost value when the vector information is used to assist the TALF filtering and a cost value when the vector information is not used to assist the TALF filtering; determine the auxiliary filtering identification information according to the cost value when the vector information is used to assist the TALF filtering and the cost value when the vector information is not used to assist the TALF filtering, and write the auxiliary filtering identification information into a bitstream; wherein the auxiliary filtering identification information is used to determine whether the vector information is used to assist the TALF filtering. A code stream is generated by bit-encoding according to information to be encoded; wherein The information to be encoded at least includes the auxiliary filtering identification information and the filtering mode. An encoder includes a first determining unit; wherein The first determining unit is configured to determine a filter coefficient and a filtering mode when a current image is filtered using TALF, and determine at least one reference position corresponding to a current position according to the filtering mode and vector information corresponding to the current position. Filtering is performed based on the filtering mode, the reconstructed samples of the at least one reference position, and the filter coefficient to determine a filtered reconstructed value of the current position. An encoder includes a first memory and a first processor; wherein The first memory is configured to store a computer program capable of running on the first processor. The first processor is configured to execute the method according to any one of claims 20 to 35 when running the computer program. A decoder includes a second determining unit; wherein The second determining unit is configured to determine a filter coefficient and a filtering mode when it is determined that a current image is filtered using TALF, and determine at least one reference position corresponding to a current position according to the filtering mode and vector information corresponding to the current position. Filtering is performed based on the filtering mode, the reconstructed samples of the at least one reference position, and the filter coefficient to determine a filtered reconstructed value of the current position. A decoder includes a second memory and a second processor; wherein The second memory is configured to store a computer program capable of running on the second processor. The second processor is configured to execute the method according to any one of claims 1 to 19 when running the computer program. A computer readable storage medium stores a computer program, and the computer program is executed to implement the decoding method according to any one of claims 1 to 19, or implement the encoding method according to any one of claims 20 to 35. A computer readable storage medium is used to store a bitstream generated by the encoding method according to any one of claims 20 to 35.