WO2022184109A1 - 用于滤波的方法、装置及设备 - Google Patents

用于滤波的方法、装置及设备 Download PDF

Info

Publication number
WO2022184109A1
WO2022184109A1 PCT/CN2022/078876 CN2022078876W WO2022184109A1 WO 2022184109 A1 WO2022184109 A1 WO 2022184109A1 CN 2022078876 W CN2022078876 W CN 2022078876W WO 2022184109 A1 WO2022184109 A1 WO 2022184109A1
Authority
WO
WIPO (PCT)
Prior art keywords
adaptive correction
filtering
filter
lcu
value
Prior art date
Application number
PCT/CN2022/078876
Other languages
English (en)
French (fr)
Inventor
潘冬萍
孙煜程
陈方栋
王莉
Original Assignee
杭州海康威视数字技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 杭州海康威视数字技术股份有限公司 filed Critical 杭州海康威视数字技术股份有限公司
Priority to JP2023547310A priority Critical patent/JP2024506002A/ja
Priority to US18/262,227 priority patent/US20240146916A1/en
Priority to KR1020237024597A priority patent/KR20230119718A/ko
Publication of WO2022184109A1 publication Critical patent/WO2022184109A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/117Filters, e.g. for pre-processing or post-processing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/80Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/103Selection of coding mode or of prediction mode
    • H04N19/105Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/136Incoming video signal characteristics or properties
    • H04N19/14Coding unit complexity, e.g. amount of activity or edge presence estimation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/182Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a pixel
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/70Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by syntax aspects related to video coding, e.g. related to compression standards
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/80Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation
    • H04N19/82Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation involving filtering within a prediction loop
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression
    • H04N19/86Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression involving reduction of coding artifacts, e.g. of blockiness

Definitions

  • the present application relates to video coding and decoding technology, and in particular, to a method, apparatus and device for filtering.
  • Complete video coding generally includes operations such as prediction, transformation, quantization, entropy coding, and filtering. There is a quantization operation after block-based motion compensation, which generates coding noise and distorts the video quality. Often, in-loop post-processing techniques can be used to reduce the effects of such distortions. However, it is found in practice that the filtering performance of the existing loop post-processing technology is poor.
  • the present application provides a filtering method, apparatus and device. Specifically, the application is achieved through the following technical solutions:
  • a filtering method applied to an encoding/decoding device, the method includes: determining whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering; if it is determined that the current adaptive correction filtering unit The filtering unit allows the use of enhanced adaptive correction filtering, and uses the first filter to perform adaptive correction filtering on the current adaptive correction filtering unit; if it is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering, use the second filter.
  • the filter performs adaptive correction filtering on the current adaptive correction filtering unit.
  • the first filter is a 7*7 cross and a 5*5 square center-symmetric filter
  • the second filter is a 7*7 cross and a 3*3 square center-symmetric filter.
  • determining whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering includes: determining whether to indicate whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering.
  • the flag bit value of the adaptive correction filtering when the flag bit value is the first value, it is determined that the current adaptive correction filter unit is allowed to use the enhanced adaptive correction filter, when the flag bit value is the second value It is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering.
  • the flag bit used to indicate whether the current adaptive correction filtering unit is allowed to use the enhanced adaptive correction filtering may be EalfEnableFlag; the value of the EalfEnableFlag may be derived from the decoding device, or at the decoding end device may be The value of the EalfEnableFlag is obtained from the code stream, or the value of the EalfEnableFlag is a constant value.
  • Obtaining the value of the EalfEnableFlag from the code stream at the decoding end device may include: determining the value of the EalfEnableFlag based on the value of the enhanced adaptive correction filtering permission flag parsed from the code stream, and the enhanced The adaptive correction filtering enable flag can be a sequence level parameter.
  • the method further includes: in the process of adaptively correcting and filtering the current filtering pixels in the current adaptive correction filtering unit, for the current filtering pixels
  • the reference pixel when the reference pixel is in the current adaptive correction filtering unit, use the pixel value of the reference pixel to perform adaptive correction filtering; when the reference pixel is not in the current adaptive correction filtering unit , in the case that the pixel value of the reference pixel cannot be obtained, use the pixel closest to the reference pixel position in the current adaptive correction filtering unit to replace the reference pixel to perform adaptive correction filtering, and obtain the reference pixel.
  • adaptive correction filtering is performed using the pixel value of the reference pixel.
  • the situation that the pixel value of the reference pixel cannot be obtained includes one of the following: the reference pixel is in the image of the current image frame Outside the boundary, outside the slice boundary of the current slice and filtering across slice boundaries is not allowed, outside the upper or lower boundary of the current adaptive modification filtering unit.
  • the method further includes: if it is determined that the current adaptive correction filtering unit allows Enhanced adaptive correction filtering is used, and the pixel value of the pixel position used for the adaptive correction filtering of the current adaptive correction filtering unit cannot be obtained, then the pixel closest to the reference pixel position in the current adaptive correction filtering unit is used to replace the pixel value.
  • Adaptive correction filtering is performed with reference to pixels; if it is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering, and the pixel value of the pixel position used to perform the adaptive correction filtering of the current adaptive correction filtering unit cannot be obtained, then Using the pixel closest to the reference pixel in the current adaptive correction filtering unit to replace the reference pixel to perform adaptive correction filtering.
  • a filtering apparatus which is applied to an encoding/decoding device, the apparatus comprising: a filtering unit configured to determine whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering; The filtering unit is also used to perform adaptive correction filtering on the current adaptive correction filtering unit using the first filter if it is determined that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering; if it is determined that the current adaptive correction filtering The unit does not allow the use of enhanced adaptive correction filtering, and the second filter is used to perform adaptive correction filtering on the current adaptive correction filtering unit.
  • the first filter is a 7*7 cross and a 5*5 square center-symmetric filter
  • the second filter is a 7*7 cross and a 3*3 square center-symmetric filter.
  • the filtering unit determines whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, including: determining whether the current adaptive correction filtering unit is used to indicate whether the current adaptive correction filtering unit is used.
  • the flag bit value of the enhanced adaptive correction filtering is allowed to be used, and when the flag bit value is the first value, it is determined that the current adaptive correction filtering unit is allowed to use the enhanced adaptive correction filter, and the flag bit value is the first value.
  • the value is two, it is determined that the current adaptive correction filtering unit is not allowed to use enhanced adaptive correction filtering.
  • the flag bit used to indicate whether the current adaptive correction filtering unit is allowed to use the enhanced adaptive correction filtering may be EalfEnableFlag; the value of the EalfEnableFlag may be derived from the decoding device, or at the decoding end device may be The value of the EalfEnableFlag is obtained from the code stream, or the value of the EalfEnableFlag is a constant value.
  • Obtaining the value of the EalfEnableFlag from the code stream at the decoding end device may include: determining the value of the EalfEnableFlag based on the value of the enhanced adaptive correction filtering permission flag parsed from the code stream, and the enhanced The adaptive correction filtering enable flag can be a sequence level parameter.
  • the filtering unit is further configured to perform adaptive correction and filtering on the current filtering pixels in the current adaptive correction filtering unit.
  • Any reference pixel of the pixel when the reference pixel is in the current adaptive correction filtering unit, use the pixel value of the reference pixel to perform adaptive correction filtering; when the reference pixel is not in the current adaptive correction filtering unit
  • the pixel value of the reference pixel cannot be obtained, use the pixel closest to the reference pixel position in the current adaptive correction filtering unit to perform adaptive correction filtering instead of the reference pixel, and when the reference pixel is obtained.
  • adaptive correction filtering is performed using the pixel value of the reference pixel.
  • the situation that the pixel value of the reference pixel cannot be obtained includes one of the following: the reference pixel is in the image of the current image frame Outside the boundary, outside the slice boundary of the current slice and filtering across slice boundaries is not allowed, outside the upper or lower boundary of the current adaptive modification filtering unit.
  • the filtering unit is further configured to: if the current adaptive correction is determined The filtering unit allows the use of enhanced adaptive correction filtering, and the pixel value of the pixel position used to perform the adaptive correction filtering of the current adaptive correction filtering unit cannot be obtained, then use the current adaptive correction filtering unit The nearest to the reference pixel position is used. The pixel replaces the reference pixel to perform adaptive correction filtering; if it is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering, and the pixel value of the pixel position used to perform the adaptive correction filtering of the current adaptive correction filtering unit cannot be used. Obtained, the pixel in the current adaptive correction filtering unit that is closest to the reference pixel position is used to replace the reference pixel to perform adaptive correction filtering.
  • a decoding device including a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, the The processor is configured to execute machine-executable instructions to implement the filtering method provided in the first aspect.
  • an encoding device including a processor and a machine-readable storage medium, where the machine-readable storage medium stores machine-executable instructions that can be executed by the processor, the The processor is configured to execute machine-executable instructions to implement the filtering method provided in the first aspect.
  • the filtering method of the embodiment of the present application by determining whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, and when it is determined that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, the first filter pair is used.
  • the current adaptive correction filtering unit performs adaptive correction filtering; when it is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering, the second filter is used to perform adaptive correction on the current adaptive correction filtering unit Filtering improves the flexibility of filter selection, optimizes the filtering effect, and improves the encoding and decoding performance.
  • FIG. 1A and 1B show a schematic flowchart of video encoding and decoding
  • Fig. 2 is a kind of schematic diagram of area division
  • Fig. 3 is a kind of schematic diagram of area merging
  • 4A is a schematic diagram of a 7*7 cross plus a 5*5 square center-symmetric filter shape
  • FIG. 4B is a schematic diagram of a reference pixel corresponding to the filter shown in FIG. 4A;
  • 4C is a schematic diagram of a reference pixel position for filtering the current adaptive correction filtering unit
  • FIG. 5 is a schematic diagram of a sample filtering compensation unit shown in an exemplary embodiment of the present application.
  • FIG. 6A is a schematic flowchart of a filtering method according to an exemplary embodiment of the present application.
  • FIG. 6B is a schematic flowchart of a filtering method according to an exemplary embodiment of the present application.
  • FIG. 7 is a schematic flowchart of a filtering method according to an exemplary embodiment of the present application.
  • FIG. 8 is a schematic flowchart of a filtering method according to an exemplary embodiment of the present application.
  • FIG. 9 is a schematic diagram of a 7*7 cross plus a 3*3 square center-symmetric filter shape
  • FIG. 10 is a schematic diagram of a merged region shown in an exemplary embodiment of the present application.
  • FIGS. 11A to 11D are schematic diagrams of various filter shapes shown in an exemplary embodiment of the present application.
  • FIG. 12 is a schematic diagram of a 3*3 pixel block shown in an exemplary embodiment of the present application.
  • FIG. 13 is a schematic diagram of a filter with asymmetric filter coefficients according to an exemplary embodiment of the present application.
  • FIG. 14A is a schematic diagram of a reference pixel position according to an exemplary embodiment of the present application.
  • FIG. 14B is a schematic diagram of another reference pixel position shown in an exemplary embodiment of the present application.
  • FIG. 15A and FIG. 15B are schematic diagrams illustrating secondary division of regions obtained by various ways of dividing fixed regions according to an exemplary embodiment of the present application
  • FIG. 15C is a schematic diagram showing the area numbers corresponding to each secondary division manner in FIG. 15A according to an exemplary embodiment of the present application;
  • FIG. 16 is a schematic structural diagram of a filtering device according to an exemplary embodiment of the present application.
  • FIG. 17 is a schematic structural diagram of a filtering device according to an exemplary embodiment of the present application.
  • FIG. 18 is a schematic diagram of the hardware structure of a decoding device shown in an exemplary embodiment of the present application.
  • FIG. 19 is a schematic diagram of a hardware structure of an encoding device according to an exemplary embodiment of the present application.
  • Rate-Distortion Optimized The indicators for evaluating coding efficiency include code rate and Peak Signal to Noise Ratio (PSNR). The smaller the bit rate, the greater the compression rate; the greater the PSNR, the better the reconstructed image quality. In mode selection, the discriminant formula is essentially a comprehensive evaluation of the two.
  • D represents the distortion (Distortion), which is usually measured by the SSE (sum of difference mean square) index.
  • SSE refers to the mean square sum of the difference between the reconstructed block and the source image block;
  • is the Lagrange multiplier;
  • R is the The actual number of bits required for image block coding in this mode, including the sum of bits required for coding mode information, motion information, residuals, etc.
  • mode selection if the RDO principle is used to make comparison decisions on encoding modes, the best encoding performance can usually be guaranteed.
  • Coding Tree Unit Traditional video coding is implemented based on macroblocks. For video in 4:2:0 sampling format, a macroblock contains a 16 ⁇ 16 luminance block and two An 8x8 chroma block. Considering the characteristics of high-definition video/ultra-high-definition video, CTU is introduced in Versatile Video Coding (VVC for short), and its size is specified by the encoder and is allowed to be larger than the size of the macroblock.
  • VVC Versatile Video Coding
  • the value range of the luminance CTB size is ⁇ 8 ⁇ 8, 16 ⁇ 16, 32 ⁇ 32, 64 ⁇ 64, 128 ⁇ 128 ⁇
  • the value range of the chroma CTB size is ⁇ 4 ⁇ 4, 8 ⁇ 8, 16 ⁇ 16, 32 ⁇ 32, 64 ⁇ 64 ⁇
  • a larger CTB can be used for better compression.
  • Deblocking Filter (DBF for short): The image encoding process is based on different blocks, and each block is encoded relatively independently. Since each block uses different parameters, the distribution characteristics within the block are independent of each other, resulting in a discontinuous phenomenon at the edge of the block, which can be called the block effect.
  • the deblocking filter mainly smoothes the boundaries of the blocks to remove the block effect.
  • Sample Adaptive Offset Starting from the pixel domain, classifying the reconstructed image into categories according to the characteristics of the reconstructed image, and then performing compensation processing in the pixel domain. Mainly to reduce the ringing effect.
  • Adaptive Leveling Filter applied after DB and SAO, mainly to further improve image quality under objective conditions.
  • ALF technology builds a multiple linear regression model based on least squares, and performs filter compensation in the pixel domain.
  • post-loop processing techniques may include DBF, SAO, and ALF.
  • Wiener filtering The essence is to minimize the mean square value of the estimation error (defined as the difference between the expected response and the actual output of the filter).
  • video coding generally includes processes such as prediction, transformation, quantization, and entropy coding. Further, the encoding process can be implemented according to the framework of FIG. 1B .
  • Intra-frame prediction uses the surrounding coded blocks as a reference to predict the current uncoded blocks, effectively removing the redundancy in the spatial domain.
  • Inter prediction is to use adjacent coded images to predict the current image, effectively removing the redundancy in the temporal domain.
  • Transformation refers to converting an image from the spatial domain to the transform domain, and using transformation coefficients to represent the image. Most images contain many flat areas and slowly changing areas. Appropriate transformation can transform the image from a scattered distribution in the spatial domain to a relatively concentrated distribution in the transformed domain. In other words, the transform can remove the frequency-domain correlation between the signals, and by cooperating with the quantization process, the code stream can be effectively compressed.
  • Entropy coding is a lossless coding method, which can convert a series of element symbols into a binary code stream for transmission or storage.
  • the input symbols may include quantized transform coefficients, motion vector information, prediction mode information, and transform and quantization correlation. grammar, etc.
  • Entropy coding can effectively remove the redundancy of video element symbols.
  • video decoding usually includes entropy decoding, prediction, inverse quantization, inverse transformation, filtering and other processes, and the implementation principles of each process in video decoding are the same or similar to those in video encoding.
  • video decoding usually includes entropy decoding, prediction, inverse quantization, inverse transformation, filtering and other processes, and the implementation principles of each process in video decoding are the same or similar to those in video encoding.
  • the ALF technology used in the framework of the Audio Video Coding Standard calculates the optimal linear filtering that can be achieved by the original signal and the distorted signal in the mean square sense according to the principle of Wiener filtering.
  • the ALF encoding process may include: region division ⁇ acquiring reference pixels ⁇ region merging and calculating filter coefficients ⁇ decision to determine whether each LCU starts filtering.
  • the parameters that need to be calculated and obtained in the whole process are: 1), the number of filtering parameters; 2), the region merge identification; 3), each group of filter coefficients; 4), whether the LCU starts the filtering identification; 5), the current component (Y, U, V) whether to start the filter flag.
  • the data on the luminance component is subjected to partition processing, and the data on the chrominance component is subjected to non-partition processing.
  • the specific implementation process of the region division may be: dividing the image into 16 regions of substantially equal size and aligned based on the LCU.
  • the width of the non-rightmost region is (((pic_width_InLcus+1)/4) ⁇ Lcu_Width), where pic_width_InLcus represents the number of LCUs in the image width, and Lcu_Width represents the width of each LCU.
  • the width of the rightmost region is the difference between the image width and the widths of the three non-rightmost regions (the image width minus the total width of the three non-rightmost regions).
  • the height of the non-bottom area is (((pic_height_InLcus+1)/4) ⁇ Lcu_Height), where pic_height_InLcus represents the number of LCUs on the image height, and Lcu_Height represents the height of each LCU.
  • the height of the bottommost area is the difference between the image height and the heights of the three non-bottom areas (image height minus the total height of the non-bottom three areas).
  • the region merging operation refers to judging whether adjacent regions are merged according to the order of index values.
  • the purpose of combining is to reduce coding coefficients.
  • a merge flag is required to indicate whether the current area is merged with the adjacent area.
  • a total of 16 regions are included (which can be called 16 categories or 16 groups (groups), and the index values are 0 to 15 in sequence).
  • 0 and region 1 are combined, region 1 and region 2 are combined, region 2 and region 3 are combined, ..., region 13 and region 14 are combined, region 14 and region 15 are combined, and the combination method with the smallest error is carried out.
  • a region merge, so that 16 regions are merged into 15 regions.
  • region 14 and region 15 are merged to obtain region 14+15, that is, the merged region includes region 2+3 and region 14+15
  • region 14 and region 15 are merged to obtain region 14+15, that is, the merged region includes region 2+3 and region 14+15
  • merge area 1 and area 2+3, merge area 2+3 and area 4 ..., merge area 12 and area 13, merge area 13 and area 14+15, and perform the merge method with the smallest error
  • the filter coefficients may be calculated according to the Wiener filtering principle based on the reference pixels of the pixels in each region.
  • each pixel is taken as the current pixel
  • the surrounding pixels are taken as the reference pixel within a certain range centered on the pixel
  • the reference pixel and the current pixel are used as input
  • the pixel is taken as the input.
  • the original value of is used as the target, and the filter coefficients are calculated by the least square method.
  • FIG. 4A is a schematic diagram of a filter shape. As shown in FIG. 4A , it is a center-symmetric filter shape with a 7*7 cross shape and a 5*5 square shape, and the reference pixel corresponding to the filter can be seen in FIG. 4B .
  • Pi belongs to the pixel in the reconstructed image before filtering
  • Wiener filtering is to linearly combine the reference pixel values around the current pixel to approximate the current pixel value of the original image.
  • the ALF technology is processed based on the largest coding unit (Largest Coding Unit, LCU for short). LCUs belonging to the same merged region use the same set of filter coefficients for filtering.
  • LCU Large Coding Unit
  • the adaptive modified filtering unit is derived according to the current maximum coding unit according to the following steps:
  • the sample where the upper boundary of the sample area E1 is located belongs to the upper boundary of the image, or belongs to the slice boundary and the value of cross_patch_loopfilter_enable_flag is '0', make the sample area E2 equal to the sample area E1; otherwise, the luminance component and chrominance component samples are
  • the upper boundary of the area E1 is extended upwards by four rows to obtain the sample area E2; the first row of samples in the sample area E1 is the upper boundary of the area;
  • the sample area E2 is used as the current adaptive correction filtering unit; the first row of samples of the image is the upper boundary of the image, and the last row of samples of the image is the lower boundary of the image.
  • the reference pixel used in the adaptive correction filtering process is a sample in the adaptive correction filtering unit, then the sample is directly used for filtering;
  • the sample used in the adaptive correction filtering process is the sample in the adaptive correction filtering unit, the sample is directly used for filtering; otherwise, the filtering is performed as follows:
  • the LCU is used as the basic unit to determine whether each LCU in the current image uses ALF.
  • the encoding device may calculate the rate-distortion cost before and after the current LCU is turned on and off, to determine whether the current LCU uses the ALF. If the current LCU is marked to use ALF, Wiener filtering is performed on each pixel within the LCU.
  • the ALF technology only transmits a fixed set of filter coefficients for each region, and the filter shape is fixed. Therefore, there may be some problems, such as: fixedly divided regions cannot divide pixels with the same characteristics into the same category, or the shape of the filter used is inappropriate. At the same time, each divided region transmits at most one set of filter coefficients. For larger regions or regions with complex image textures, one set of filter coefficients is not enough.
  • N is a positive integer.
  • the LCUs in each area are divided into the same category, it corresponds to the fixed area division scheme of the traditional ALF scheme. In order to distinguish it from the fixed area division method of the traditional ALF scheme, N ⁇ 2.
  • Scheme 2 Multiple sets of filter coefficients can be transmitted in each region, and the shape of each set of filters can be the same or different.
  • a set of filter coefficients is adaptively selected based on each LCU, and LCUs in the same region can select filter coefficients in adjacent regions.
  • Each region can only transmit one set of filter coefficients, but the filter shape of each region can be different.
  • Option 5 Modify the symmetric filter into an asymmetric filter, including optimizing the filter coefficients at the symmetrical positions to be the same so that the filter coefficients at the symmetrical positions satisfy a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4.
  • Scheme 6 Optimize the sample value of the boundary during filtering.
  • ALF filtering is performed using the solution provided by the embodiments of the present application under the size of the LCU as an example, but in the embodiments of the present application, other sizes or methods for representing image blocks may also be used instead, such as image blocks of N*M size, N is a positive integer less than or equal to the width of the image frame, and M is a positive integer less than or equal to the height of the image frame.
  • An embodiment of the present application provides a filtering method, wherein the filtering method can be applied to a decoding device, and the filtering method can include the following steps:
  • T600 Perform regional division on the luminance component of the current image frame.
  • T610 Determine the area type to which the LCU belongs based on the area type identifier of the LCU obtained by parsing from the code stream.
  • the pixel characteristics of each pixel in the area can be used.
  • the LCU is divided into at least one category, that is, an area may be divided into at least one sub-area or area category by means of LCU classification.
  • the category of the region to which the LCU belongs may be determined based on the region to which the LCU belongs and the category of the LCU in the region to which it belongs.
  • the region type identifier for identifying the region type to which each LCU belongs may be carried in the code stream and sent to the decoding device.
  • the decoding device may parse the region category identifier of the LCU from the code stream, and determine the region category to which the LCU belongs based on the region category identifier of the LCU obtained by parsing.
  • T620 Determine the filter coefficient of the LCU based on the type of the region to which the LCU belongs and the filter coefficient parsed from the code stream.
  • the encoding device may perform region merging on each region category to obtain at least one merged region (which may be referred to as a merged region), and determine each region. Filter coefficients for merged regions.
  • region merging for each region category is similar to the relevant description in the "region merging" section above, and will not be repeated here.
  • the encoding apparatus may assign a coefficient index to it based on the merged region to which it belongs, where the coefficient index is a filter coefficient corresponding to one of the merged regions.
  • the encoding device can write the filter coefficients of each merged region and the index of each region category into the code stream, and send it to the decoding device.
  • the decoding device may determine the coefficient index of the region category to which the LCU belongs based on the region category to which the LCU belongs, and determine the filtering coefficient of the LCU based on the coefficient index and the filter coefficient parsed from the code stream. coefficient.
  • T630 Perform ALF filtering on the pixels of the LCU one by one based on the filter coefficients of the LCU.
  • ALF filtering may be performed on the pixels of the LCU one by one based on the filter coefficient of the LCU.
  • the area division is more in line with the pixel characteristics of each LCU, so that the ALF filtering effect can be optimized and the encoding and decoding performance can be improved.
  • determining the area type to which the LCU belongs based on the area type identifier of the LCU obtained by parsing from the code stream includes: determining the area type to which the LCU belongs based on the area to which the LCU belongs and the area type identifier of the LCU.
  • the region category to which the LCU belongs may be determined based on the region to which the LCU belongs (the region obtained according to the fixed region division method) and the region category identifier of the LCU.
  • the region category identifier of the LCU is used to identify the category of the LCU in the region to which the LCU belongs, and the category of the LCU in the region to which the LCU belongs is determined by classifying each LCU in the region to which the LCU belongs;
  • the above-mentioned determining the area type to which the LCU belongs based on the area to which the LCU belongs and the area type identifier of the LCU may include: determining the area type to which the LCU belongs based on the number of types of each area, the area to which the LCU belongs, and the area type identifier of the LCU.
  • the decoding device may determine the category of the LCU in the region to which the LCU belongs based on the region category identifier of the LCU obtained by parsing from the code stream. For example, assuming that LCUs in an area are divided into at most 2 types, for LCUs that are classified into the first type, their area type identifiers may be 0; for LCUs that are classified into the second type, their area type identifiers may be 0. is 1.
  • any LCU in any area when the value of the area type identifier of the LCU obtained by parsing from the code stream is 0, it can be determined that the type of the LCU in this area is the first type; When the value of the area type identifier of the LCU obtained by parsing in the LCU is 1, it can be determined that the type of the LCU in the area is the second type.
  • the decoding apparatus may determine the region category to which the LCU belongs based on the number of categories of each category, the region to which the LCU belongs, and the region category to which the LCU belongs.
  • the above-mentioned determining the region category to which the LCU belongs based on the number of categories of each region, the region to which the LCU belongs, and the region category identifier of the LCU may include: determining, based on the number of categories of regions before the region to which the LCU belongs, determining the region before the region to which the LCU belongs. The total number of categories of each area; based on the total number of categories of each area before the area to which the LCU belongs and the area category identifier of the LCU, the area category to which the LCU belongs is determined.
  • the total number of categories of the regions before the region to which the LCU belongs can be determined, and based on the total number of categories of the regions before the region to which the LCU belongs and the region category identifier of the LCU, Determine the regional category to which the LCU belongs.
  • the brightness of the current image frame is divided into L areas, and the LCUs in each area are divided into N categories, then for any LCU in the area K, when the code stream is parsed and obtained
  • the value of the area category identifier of the LCU is m, it can be determined that the area category to which the LCU belongs is N*K+m; where, m ⁇ [0, N-1], N ⁇ 1, K ⁇ [0, L- 1].
  • the method may further include: determining whether to enable ALF filtering for the LCU; when determining whether to enable ALF for the LCU During filtering, it is determined to perform the above-mentioned operation of determining the filter coefficient of the LCU based on the type of the region to which the LCU belongs and the filter coefficient parsed from the code stream.
  • the encoding apparatus may determine whether to enable ALF filtering for that LCU based on the RDO decision.
  • the decoding device may first determine whether to enable ALF filtering for the LCU. For example, the decoding device may determine whether to enable ALF filtering for the LCU based on the identifier for identifying whether to enable ALF filtering for the LCU, which is obtained by parsing the code stream.
  • the decoding device may determine the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the code stream in the manner described in the above embodiment.
  • the above-mentioned determining whether to enable ALF filtering for the LCU may include: parsing the LCU coefficient identifier of the LCU from the code stream; wherein the LCU coefficient identifier is used to identify at least one set of filter coefficients used in the merge area to which the LCU belongs , the filter coefficient used by the LCU; when the value of the LCU coefficient identifier of the LCU is not the first value, it is determined to start ALF filtering for the LCU.
  • the filter coefficients used in a merge area are no longer limited to one set of filter coefficients, but one or more sets of filter coefficients can be selected and used according to actual conditions.
  • the encoding device may train multiple sets of filter coefficients, and determine, based on the RDO decision, to use one of the sets of filter coefficients or multiple sets of filter coefficients for the merged region. For any LCU in the region, the encoding device may identify the filter coefficient used by the LCU among one or more sets of filter coefficients used in the merged region by the LCU coefficient identifier.
  • the value of the LCU coefficient identifier of the LCU is the first value, it indicates that ALF filtering is not started for the LCU.
  • the value of the LCU coefficient identifier of the LCU parsed by the decoding device from the code stream is not the first value, it may be determined to start ALF filtering for the LCU.
  • the decoding device parses the code stream and obtains the value of the LCU coefficient identifier of the LCU as 0, it can determine not to start ALF filtering for the LCU; when decoding When the LCU coefficient identifier of the LCU obtained by the device from the code stream is not 0, it can determine to start ALF filtering for the LCU, and can determine the filter coefficient used by the LCU according to the LCU coefficient identifier of the LCU.
  • the filter coefficient of the LCU is the set of filter coefficients; if the merged region to which the LCU belongs uses multiple sets of filter coefficients filter coefficient, the filter coefficient of the LCU also needs to be determined according to the specific value of the LCU coefficient identifier of the LCU.
  • determining the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the code stream may include: based on the region category to which the LCU belongs, the filter coefficient parsed from the code stream, and the filter coefficient obtained from the code stream.
  • the region coefficient identifier of the merged region to which the LCU belongs is obtained by analysis, and the filter coefficient of the LCU is determined.
  • the region coefficient identifier is used to identify the filter coefficient used in the merged region to which the LCU belongs among the preset multiple sets of filter coefficients.
  • the encoding device may train multiple sets of filter coefficients, and determine, based on the RDO decision, that the merged region uses one or more sets of the multiple sets of filter coefficients, and will be used to identify the merged region to use.
  • the region coefficients of the filter coefficients identify the write stream.
  • the decoding device may determine the filter coefficient used in the merging region based on the region coefficient identifier of the merging region obtained by parsing from the code stream.
  • the encoding device determines the merged region uses filter coefficient A, determines The value of the region coefficient identifier of the merged region is 0; when the encoding device determines that the merged region uses filter coefficient B, the encoding device determines that the value of the region coefficient identifier of the merged region is 1; when the encoding device determines that the merged region uses When filtering coefficient A and filtering coefficient B, the encoding device determines that the value of the region coefficient identifier of the merged region is 2.
  • any merged region when the decoding device determines that the region uses a set of filter coefficients based on the region coefficient identifier of the merged region obtained by parsing from the code stream, for any LCU of the merged region, when it is determined that the When the LCU starts ALF filtering, if the value of the LCU coefficient identifier of the LCU is not the first value, it can be determined that the filter coefficient used by the LCU is the filter coefficient used in the merging region; When it is determined that the merged area uses multiple sets of filter coefficients, the area coefficient identifier of the merged area obtained through analysis, when it is determined to start ALF filtering for the LCU, the filter coefficient used by the LCU (the merged filter coefficient) can be determined based on the LCU coefficient identifier of the LCU. One of the sets of filter coefficients used by the region).
  • Determining the filter coefficient of the LCU based on the category of the region to which the LCU belongs, the filter coefficients parsed from the code stream, and the region coefficient identifier of the merged region to which the LCU belongs is obtained by parsing from the code stream, which may include: when based on the region coefficient of the merged region to which the LCU belongs.
  • the filter coefficient of the LCU is determined based on the category of the region to which the LCU belongs, the filter coefficient parsed from the code stream, and the LCU coefficient identification of the LCU.
  • the decoding device when the decoding device determines the region category to which the LCU belongs based on the region category identifier of the LCU obtained by parsing from the code stream, it can also determine the merged region to which the LCU belongs based on the region category to which the LCU belongs, and based on the slave code
  • the region coefficient identifier of the merged region to which the region category belongs obtained through analysis in the stream, determines the filter coefficient used by the region category.
  • a total of 32 region categories are obtained by classifying the LCUs of the region categories.
  • An index table is obtained from the merging of the region categories, and the index table may be a 32-element one-dimensional vector, and each element in the 32-element one-dimensional vector is the index of the merged region to which each region category belongs.
  • the encoding device can send the above-mentioned index table to the decoding device through the code stream, so that the decoding device can determine the merged region to which each region category belongs based on the index table parsed from the code stream, so that for any LCU, it can be based on this index table.
  • the region category identifier of the LCU determines the region category to which the LCU belongs, and determines the merged region to which the LCU belongs according to the region category to which the LCU belongs.
  • the decoding device may determine the filter coefficient used by the LCU based on the LCU coefficient identifier of the LCU obtained by parsing from the code stream.
  • the filter shapes of the sets of filter coefficients used in the merging region may or may not be exactly the same.
  • the filter shapes of filter coefficient A, filter coefficient B and filter coefficient C may all be the same, or all different, or partially the same, such as the filter coefficients
  • the filter shapes of A and filter coefficient B are the same, but the filter shapes of filter coefficient A and filter coefficient C are different.
  • determining the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the code stream may include: based on the region category to which the LCU belongs, the filter coefficient parsed from the code stream, and the coefficient selection flag of the LCU, to determine the filter coefficient of the LCU; wherein, the coefficient selection flag is used to identify the filter coefficient selected and used by the LCU in the multiple groups of candidate filter coefficients.
  • the LCU is no longer limited to selecting the filter coefficients of the merged region to which it belongs, but can adaptively select a set of filter coefficients from multiple sets of filter coefficients for ALF filtering.
  • the candidate filter coefficients of the LCU may include, but are not limited to, the filter coefficients of the merged region to which it belongs and the filter coefficients of the adjacent merged regions of the merged region to which it belongs.
  • one LCU may have multiple groups of candidate filter coefficients, which improves the flexibility of LCU filter coefficient selection, optimizes the ALF filtering effect, and improves encoding and decoding performance.
  • the encoding device may determine, based on the RDO decision, filter coefficients used by the LCU in multiple sets of candidate filter coefficients, and write the coefficient selection identifier corresponding to the filter coefficient into the code stream and send it to the decoding device.
  • the decoding device may determine the filter coefficient of the LCU based on the region category to which the LCU belongs, the filter coefficient parsed from the code stream, and the coefficient selection flag of the LCU.
  • the above-mentioned determining the filter coefficient of the LCU based on the region category to which the LCU belongs, the filter coefficient parsed from the code stream, and the coefficient selection flag of the LCU may include: when the value of the coefficient selection flag of the LCU is the first value, the filter coefficient of the previous merged area to which the LCU belongs is determined as the filter coefficient of the LCU; when the value of the coefficient selection flag of the LCU is the second value, the filter coefficient of the merged area to which the LCU belongs is determined to be the filter coefficient of the LCU. Filter coefficient; when the value of the coefficient selection flag of the LCU is the third value, the filter coefficient of the merged area after the merged area to which the LCU belongs is determined as the filter coefficient of the LCU.
  • its candidate filter coefficients may include the filter coefficients of the merged region to which it belongs, the filter coefficients of the merged region preceding the merged region to which it belongs, and the filter coefficients of the merged region after the merged region to which it belongs.
  • the previous merged region of the merged region to which the LCU belongs is the merged region corresponding to the previous adjacent index of the index of the merged region to which the LCU belongs.
  • the next merged region of the merged region to which the LCU belongs is the merged region corresponding to the next adjacent index of the index of the merged region to which the LCU belongs.
  • the previous merged area of the merged area to which the LCU belongs is the merged area corresponding to the previous adjacent index (ie 1) of index 2 ( That is, merging region 1)
  • the next merging region of the merging region to which the LCU belongs is the merging region (ie, merging region 3) corresponding to the next adjacent index (ie, 3) of index 2.
  • the encoding device may determine the filter coefficients used by the LCU based on the RDO decision.
  • the filter coefficients used by the LCU when determining the filter coefficients of the previous merged region to which the LCU belongs, it may determine the coefficient selection flag of the LCU.
  • the value is the first value, such as 0; when the filter coefficient of the merging region to which the LCU belongs is determined, the value of the coefficient selection flag of the LCU can be determined as the second value, such as 1; Filter Coefficient Used by LCU When the filter coefficient of the merged area after the merged area to which the LCU belongs, the value of the coefficient selection flag of the LCU may be determined to be a third value, such as 2.
  • the filter coefficient of the previous merged region to which the LCU belongs can be determined. is the filter coefficient of the LCU; when the value of the coefficient selection flag of the LCU obtained by parsing from the code stream is the second value, the filter coefficient of the merged region to which the LCU belongs can be determined as the filter coefficient of the LCU; when from When the value of the coefficient selection flag of the LCU obtained by parsing in the code stream is the third value, the filter coefficient of the merged area after the merged area to which the LCU belongs may be determined as the filter coefficient of the LCU.
  • Obtaining filter coefficients by parsing from the code stream may include: for any combined region, analyzing the filter shape of the combined region from the code stream; and analyzing the filter coefficient of the combined region from the code stream based on the filter shape.
  • each merging region is no longer limited to using the same filter shape, but can selectively use different filter shapes, that is, different merging regions.
  • the filter shapes used by the regions can be the same or different.
  • the encoding device may train multiple sets of filter coefficients with different filter shapes, determine the filter shape and filter coefficients used in the merged region based on the RDO decision, and use the filter shape and filter coefficients
  • the write stream is sent to the decoding device.
  • the decoding device when acquiring the filter coefficients of the merging region, can parse the filter shape of the merging region from the code stream, and parse the region from the code stream based on the filter shape. Filter coefficients for the category.
  • determining the filter coefficient of the LCU based on the region category to which the LCU belongs and the filter coefficient parsed from the code stream may include: based on the region category to which the LCU belongs and the filter shape and filter coefficient parsed from the code stream , determine the filter shape and filter coefficient of the LCU;
  • the above-mentioned performing ALF filtering on the pixels of the LCU one by one based on the filter coefficients of the LCU may include: performing ALF filtering on the pixels of the LCU one by one based on the filter shape and filter coefficients of the LCU.
  • the combined region to which the LCU belongs may be determined based on the category of the region to which the LCU belongs, the filter shape and filter coefficient of the combined region may be parsed from the code stream, and the filter shape and filter coefficient may be determined as filter shape and filter coefficient of the LCU, and perform ALF filtering on the pixels of the LCU one by one based on the filter shape and filter coefficient.
  • a filter shape may also be selected for an image frame, or a filter shape may be selected for a component of an image frame (eg, a luminance component and/or a chrominance component).
  • a component of an image frame eg, a luminance component and/or a chrominance component.
  • ALF filtering is performed on the pixels of the LCU one by one based on the filter coefficients of the LCU, which may include: based on the filter coefficients of the LCU and parsed from the code stream. Weight coefficient, ALF filtering is performed on the pixels of the LCU one by one.
  • the filter used in the ALF filtering is no longer limited to a symmetric filter, but an asymmetric filter can be used, that is, the filter coefficients with symmetrical positions can be different, and Meet a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4.
  • the filter coefficient at the symmetrical position of the filter coefficient is necessary to use the filter coefficient based on the filter coefficient, the filter coefficient at the symmetrical position of the filter coefficient, and the sum of the products of the reference pixels at the corresponding positions, respectively.
  • the filtered pixel value is obtained. Therefore, the above ratio can be used as the ratio between the filter coefficients of the symmetrical position, or can also be used as the ratio of the weighted proportion when the pixel value of the reference pixel corresponding to the filter coefficient of the symmetrical position participates in the ALF filter calculation.
  • asymmetric filter means that the filter coefficients of the symmetrical positions are different, or the pixel values of the reference pixels corresponding to the filter coefficients of the symmetrical positions have different weights when participating in the ALF filtering calculation.
  • the filter coefficient Ci of a 7*7 cross shape plus a 5*5 square center-symmetric filter shape is C28-i
  • Ci: C28-i Ai: (2-Ai )
  • the ratio of the weighted weights of Pi and P28-i when participating in the ALF filtering calculation is Ai: (2-Ai)
  • Pi is the pixel value of the reference pixel position corresponding to Ci
  • P28-i is the corresponding pixel value of C28-i
  • the filtered pixel value of the pixel can be determined in the following manner:
  • Ci is the (i+1)th filter coefficient in the filter coefficients of the merged region to which the LCU belongs
  • Pi is the pixel value of the reference pixel position corresponding to the filter coefficient Ci
  • the pixel position of the current filter pixel is center-symmetric
  • Ai is the weight coefficient of the pixel value of the reference pixel position corresponding to Pi
  • P14 is the pixel value of the current filter pixel
  • C14 is the filter coefficient of the current filter pixel, 0 ⁇ Ai ⁇ 2.
  • the encoding device may determine the filter coefficient and filter performance of the merged region under different weight coefficients corresponding to each position. Select a set of filter coefficients with the best filtering performance, record the filter coefficients and the corresponding weight coefficients at each position of the corresponding filter, and write them into the code stream and send them to the decoding device.
  • a set of weighting coefficients (such as the above-mentioned value set of Ai) may be constructed in advance, and each weighting coefficient may be selected from the set to obtain the filtering coefficient with the best filtering performance and the corresponding filter coefficient at each position of the corresponding filter. weight coefficient, and write the index of the weight coefficient in the weight coefficient set into the code stream and send it to the decoding device.
  • the decoding device can parse the code stream to obtain the filter coefficients of the merged region to which the LCU belongs and the weight coefficients of each reference pixel position corresponding to the merged region to which the LCU belongs, and perform ALF filtering on the pixels of the LCU one by one.
  • performing ALF filtering on the pixels of the LCU one by one based on the filter coefficients of the LCU may include: for the current filtered pixel of the LCU, in the process of performing the ALF filtering on the pixel, based on the surrounding pixels of the pixel The pixel value of the pixel is updated; based on the updated pixel value of the pixel, ALF filtering is performed on the pixel.
  • the filtering performance of filtering the pixel position according to the traditional ALF technology is poor. Therefore, in order to optimize the ALF filtering effect, For the current filtered pixel, in the process of performing ALF filtering on the pixel, the pixel value of the pixel can be updated based on the pixel values of the surrounding pixels of the pixel, so that the pixel value of the pixel position is more than the pixel value of the surrounding pixels. smooth.
  • the above-mentioned updating the pixel value of the pixel based on the pixel value of the surrounding pixels of the pixel may include: determining the maximum value and the minimum value of the pixel value of each pixel in the target pixel block except the center position; Among them, the target pixel block is a 3*3 pixel block with the pixel as the center position; when the pixel value of the pixel is greater than the maximum value, the pixel value of the pixel is updated to the maximum value; when the pixel value of the pixel is less than the minimum value , update the pixel value of the pixel to the minimum value.
  • the surrounding pixels of the pixel as the 8 adjacent pixels of the pixel as an example, that is, the remaining pixels except the center position in the 3*3 pixel block (herein referred to as the target pixel block) with the pixel as the center position.
  • the pixel value of each pixel in the target pixel block except the center position may be determined, and the maximum value and the minimum value of each pixel value may be determined.
  • the pixel value of the pixel is greater than the maximum value, the pixel value of the pixel is updated to the maximum value; when the pixel value of the pixel is smaller than the minimum value, the pixel value of the pixel is updated to the minimum value.
  • the maximum value of the pixel values of the 8 pixels is the pixel value of pixel 1 (assuming it is p1), and the minimum value is the pixel value of pixel 8 ( If p8 is assumed), the pixel value of pixel 0 (assuming p0) can be compared with p1 and p8. If p0>p1, the pixel value of pixel 0 is updated to p1; if p0 ⁇ p8, then the pixel of pixel 0 is updated. The value is updated to p8.
  • FIG. 6A is a schematic flowchart of a filtering method provided by an embodiment of the present application, wherein the filtering method can be applied to an encoding/decoding device.
  • the filtering method may include the following steps:
  • Step S600a in the process of carrying out ALF filtering to the current filter pixel in the current adaptive correction filter unit, for any reference pixel of the current filter pixel, when the reference pixel is not in the current adaptive correction filter unit, go to Step S610a.
  • Step S610a determine whether the pixel value of the reference pixel can be obtained; if so, go to step S630a; otherwise, go to step S620a.
  • Step S620a use the current adaptive correction filtering unit and the pixel closest to the reference pixel in the boundary area to replace the reference pixel for filtering.
  • Step S630a use the reference pixel to perform filtering.
  • the filtering unit may be an LCU, or an image block obtained based on the LCU, for example, an image block obtained by cropping or expanding the LCU.
  • the part may not be obtained.
  • the pixel value of the reference pixel considering that for the boundary pixels of the filtering unit, there may be some reference pixels of the boundary pixels that are outside the filtering unit, that is, not in the filtering unit, at this time, the part may not be obtained.
  • the pixel value of the reference pixel that cannot be obtained may include, but is not limited to, one of the following: the reference pixel is outside the image boundary, outside the slice boundary and is not allowed to filter across the slice boundary, in the current adaptive correction filtering unit outside the upper or lower boundary of the .
  • the current adaptive correction filtering unit and the pixel closest to the position of the reference pixel in the boundary area can be used for filtering instead of the reference pixel.
  • the distance between pixel locations may be Euclidean distance.
  • the boundary area includes outside the left border or outside the right border of the current adaptive correction filtering unit, and outside the left border of the current adaptive correction filtering unit includes part or all of the area in the adjacent filtering units on the left side of the current adaptive correction filtering unit, Outside the right border of the current adaptive correction filtering unit includes part or all of the area in the adjacent filtering units to the right of the current adaptive correction filtering unit.
  • the boundary area of the current adaptive correction filtering unit may include the left border of the sample filtering compensation unit shown in FIG. 5 .
  • the boundary area of the current adaptive correction filtering unit may include The 3-column pixels on the right side of the right border of the sample filtering and compensation unit shown in 5 (that is, the 3-column pixels in the filtering unit on the right side of the current adaptive modification filtering unit, which are close to the current adaptive modification filtering unit, may be called outside the right border).
  • the method includes: determining whether the reference pixel corresponds to the specified position of the filter shape; if so, determining to perform the above-mentioned filtering operation using the current adaptive correction filtering unit and the pixel closest to the reference pixel position in the boundary area instead of the reference pixel.
  • a reference pixel at a certain position when the pixel value of the reference pixel cannot be obtained, usually the pixel value of the pixel position closest to the position in the boundary area cannot be obtained. For example, a reference pixel at a position just to the left, right, just above, or below the current filtered pixel position.
  • the current filtered pixel position ie, the pixel position corresponding to C14
  • the reference pixel position since the reference pixel position is on the left side of the current filtered pixel position, And the distance from the current filter pixel position is 3 pixels, and the width of a filter unit is usually greater than 3 pixels. Therefore, if the pixel value of the reference pixel position corresponding to C11 cannot be obtained, the current adaptive correction filter unit can be determined.
  • the filtering unit on the left is outside the boundary of the current image frame (that is, the picture frame where the current adaptive correction filtering unit is located), or, is outside the slice boundary of the current slice (that is, the slice where the current adaptive correction filtering unit is located) and is not. It is allowed to filter across the slice boundary.
  • the pixel position that is closest to the reference pixel position in the boundary area that is, the pixel value of the pixel position corresponding to C12, cannot be obtained.
  • the pixel value from the reference pixel position (the reference pixel position corresponding to C11) is used for filtering instead of the reference pixel.
  • the reference pixel at the upper left, upper right, lower left or lower right of the current filter pixel position when its pixel value cannot be obtained, it may be because it is outside the upper or lower boundary of the current adaptive correction filter unit (the current adaptive correction filter unit The pixel value of the pixel position outside the upper boundary or the lower boundary of the correction filtering unit cannot be obtained), and at this time, the pixel position closest to the reference pixel position may be outside the left or right boundary of the current adaptive correction filtering unit, Its pixel value may be available.
  • the current filtered pixel position (ie, the pixel position corresponding to C14) is at the upper left of the current adaptive correction filtering unit, for the reference pixel position corresponding to C1
  • the reference pixel position corresponding to C1 may be outside the upper boundary of the current adaptive correction filter unit, so the pixel value of the reference pixel position cannot be obtained
  • the pixel position corresponding to C6 may be outside the left boundary of the current adaptive correction filter unit, and its pixel value may be available.
  • the reference pixel position corresponding to C1 since the reference pixel position corresponding to C1 is outside the upper boundary of the current adaptive correction filter unit, the pixel value of the reference pixel position corresponding to C1 cannot be obtained, and the reference pixel position corresponding to C6 is in Outside the left boundary of the current adaptive correction filtering unit, when the pixel values outside the left boundary of the current adaptive correction filtering unit can be obtained, such as when the left boundary of the current adaptive correction filtering unit is not an image boundary or a slice boundary, the reference pixel position corresponding to C6 Therefore, in this case, for the reference pixel position where the pixel value cannot be obtained, the pixel value of the nearest pixel position in the current adaptive correction filtering unit or in the boundary area can be used to replace the reference pixel filter.
  • the current adaptive correction filtering unit and the boundary area closest to the reference pixel position can be used.
  • the pixel is filtered in place of the reference pixel.
  • the pixel closest to the reference pixel position in the current adaptive correction filtering unit may be used instead of the reference pixel for filtering, that is, the pixels in the boundary area are not considered.
  • the specified positions may include, but are not limited to, a first position, a second position, a third position, and a symmetrical position of the first position, the second position, and the third position in the first filter; wherein the first position
  • the filter is a 7*7 cross-shaped plus 5*5 square center-symmetric filter, the first position is the upper left corner of the first filter, the second position is the right adjacent position of the first position, and the third position is The adjacent position below the first position, the symmetrical position includes an axis-symmetrical position and a centrally-symmetrical position.
  • the first position is the C1 position
  • the axisymmetric position is the C5 position
  • the second position is the C2 position
  • the axisymmetric position is the C4 position
  • the third position is the C6 position
  • its axis-symmetrical position is the C10 position, that is, the above specified positions may include C1, C2, C6, C4, C5 and C10.
  • the filters used are typically different.
  • the filter used in the case of allowing the use of enhanced adaptive correction filtering may be as shown in FIG. 4A
  • the filter used in the case of not allowing the use of enhanced adaptive correction filtering may be as shown in FIG. 9 .
  • the pixels in the boundary area may not be used to replace the reference pixels whose pixel values cannot be obtained for filtering, and the pixels in the current adaptive correction filtering unit may be used to replace the pixels whose pixel values cannot be obtained.
  • the reference pixel is filtered. Therefore, for any reference pixel, if the pixel value of the reference pixel cannot be obtained, it can be determined whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering.
  • EalfEnableFlag it indicates that enhanced adaptive correction filtering can be used; when EalfEnableFlag is equal to 0, it indicates that it should not be used.
  • EalfEnableFlag is equal to 1
  • the value of EalfEnableFlag may be derived from the decoding end, or obtained from the code stream at the decoding end, and the value of EalfEnableFlag may also be a constant value.
  • the value of EalfEnableFlag may be determined based on the value of the enhanced adaptive correction filtering enable flag (ealf_enable_flag) obtained by parsing from the code stream.
  • the "Enhanced Adaptive Correction Filtering Allowed Flag” can be a sequence-level parameter, that is, a value of the "Enhanced Adaptive Correction Filtering Allowed Flag” can be used to indicate whether an image sequence is allowed to use the Enhanced Adaptive Correction Filtering.
  • the current adaptive correction filtering unit can be used. The pixel closest to the reference pixel in the adaptive correction filtering unit replaces the reference pixel for filtering.
  • the boundary can be used.
  • the pixel closest to the reference pixel in the region replaces the reference pixel for filtering.
  • the current adaptive correction filtering unit can be used.
  • the adaptive correction filtering unit and the pixel closest to the reference pixel position in the boundary area perform filtering instead of the reference pixel.
  • the decoding device determines that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering, and the pixel value of the pixel position used to perform the adaptive correction filtering of the current adaptive correction filtering unit cannot be obtained, it may be The pixel in the current adaptive correction filtering unit that is closest to the reference pixel position is used instead of the reference pixel to perform adaptive correction filtering, that is, the reference pixels in the boundary area are not considered.
  • FIG. 6B a schematic flowchart of a filtering method provided by an embodiment of the present application, wherein the filtering method can be applied to an encoding/decoding device.
  • the filtering method may include the following steps:
  • Step S600b determining whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering. If yes, go to step S610b; otherwise, go to step S620b.
  • Step S610b using the first filter to perform adaptive correction filtering on the current adaptive correction filtering unit.
  • Step S620b using the second filter to perform adaptive correction filtering on the current adaptive correction filtering unit.
  • the adaptive correction filtering unit allows the use of enhanced adaptive correction filtering and the filter used when the enhanced adaptive correction filtering is not allowed. device can be different.
  • the filter used for performing the adaptive correction filtering on the current adaptive correction filtering unit may be the first filter.
  • the first filter may be the filter shown in FIG. 4A .
  • the filter used for performing the adaptive correction filtering on the current adaptive correction filtering unit may be the second filter.
  • the second filter may be the filter shown in FIG. 9 .
  • determining whether the current adaptive correction filtering unit is allowed to use the enhanced adaptive correction filtering may include: determining a flag bit used to indicate whether the current adaptive correction filtering unit is allowed to use the enhanced adaptive correction filtering Value, when the flag bit is the first value, it is determined that the current adaptive correction filtering unit is allowed to use enhanced adaptive correction filtering, and when the flag is the second value, it is determined that the current adaptive correction filtering unit is not allowed to use Enhanced adaptive correction filtering.
  • a flag bit may be used to indicate whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering. Exemplarily, when the value of the flag bit is the first value (eg, 0), it indicates that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering. When the value of the flag bit is the second value (eg 1), it indicates that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering.
  • the decoding device may acquire the value of the flag bit, and determine whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering based on the value of the flag bit.
  • the unobtainable pixel value of a reference pixel may include, but is not limited to, one of the following: the reference pixel is outside the image boundary of the current image frame, outside the slice boundary of the current slice and filtering across slice boundaries is not allowed, Outside the upper or lower boundary of the current adaptive correction filter unit.
  • the current adaptive correction filtering unit and the pixel closest to the reference pixel position in the boundary area can be used to replace the reference pixel for filtering.
  • the distance between pixel locations may be Euclidean distance.
  • the boundary area includes outside the left border or outside the right border of the current adaptive correction filtering unit, and outside the left border of the current adaptive correction filtering unit includes part or all of the area in the adjacent filtering units on the left side of the current adaptive correction filtering unit, Outside the right border of the current adaptive correction filtering unit includes part or all of the area in the adjacent filtering units to the right of the current adaptive correction filtering unit.
  • the current adaptive correction filtering unit determines that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, and the pixel value of the pixel position used to perform the adaptive correction filtering of the current adaptive correction filtering unit cannot be obtained.
  • the pixel closest to the reference pixel position replaces the reference pixel to perform adaptive correction filtering; if it is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering, and is used to perform the self-adaptive correction filtering of the current adaptive correction filtering unit. If the pixel value of the pixel position of the adaptive correction filtering cannot be obtained, the pixel closest to the reference pixel position in the current adaptive correction filtering unit is used instead of the reference pixel to perform the adaptive correction filtering.
  • An embodiment of the present application provides a filtering method, wherein the filtering method can be applied to a decoding device, and the filtering method can include the following steps:
  • T710 Obtain the filter coefficients of the current LCU based on the region coefficient identifiers of the merging regions to which the current LCU belongs, where the region coefficient identifiers are used to identify filter coefficients used in the merging regions to which the LCU belongs in the preset multiple sets of filter coefficients.
  • the filter coefficients used in a merge area are no longer limited to one set of filter coefficients, and one or more sets of filter coefficients can be selected and used according to actual conditions.
  • the encoding device may train multiple sets of filter coefficients, and determine, based on the RDO decision, that the merged region uses one or more sets of the multiple sets of filter coefficients, and will be used to identify the merged region to use.
  • the region coefficients of the filter coefficients identify the write stream.
  • the decoding device may obtain the region coefficient identifier of the merged region to which the current LCU belongs based on the information parsed from the code stream, and based on the region coefficient identifier , to determine the filter coefficients used in the merge area to which the current LCU belongs.
  • the filter coefficient of the current LCU may be determined from the filter coefficients used by the merge area.
  • the filter coefficients used in the merged region may be determined as the filter coefficients of the current LCU.
  • T720 Perform ALF filtering on the pixels of the current LCU one by one based on the filter coefficients of the current LCU.
  • ALF filtering may be performed on the pixels of the current LCU one by one based on the filter coefficient of the current LCU.
  • each merged region uses one or more sets of the trained sets of filter coefficients, and is identified by the region coefficients
  • the decision result is notified to the decoding device, so that a region is no longer limited to using one set of filter coefficients, but can choose to use one or more sets of filter coefficients according to performance, which optimizes the ALF filtering performance and improves the encoding and decoding performance.
  • determining to start the ALF filtering on the current LCU of the current frame image may include: parsing the LCU coefficient identifier of the current LCU from the code stream; wherein the LCU coefficient identifier is used to identify the mergence to which the current LCU belongs. Among the at least one set of filter coefficients used in the region, the filter coefficients used by the current LCU; when the value of the LCU coefficient identifier of the LCU is not the first value, it is determined to start ALF filtering for the current LCU.
  • the encoding device may notify the decoding device to use one or more sets of filter coefficients to merge the regions through the region coefficient identifier. For any LCU in the region, the encoding device may identify the filter coefficient used by the LCU among one or more sets of filter coefficients used in the merged region by the LCU coefficient identifier.
  • the decoding device may determine whether to enable ALF filtering for the LCU and filter coefficients for enabling ALF filtering for the LCU based on the LCU coefficient identifier of the LCU obtained by parsing from the code stream.
  • the value of the LCU coefficient identifier of the LCU is the first value, it indicates that ALF filtering is not started for the LCU.
  • the value of the LCU coefficient identifier of the LCU parsed by the decoding device from the code stream is not the first value, it may be determined to start ALF filtering for the LCU.
  • the decoding device can determine not to start ALF filtering for the LCU; when When the value of the LCU coefficient identifier of the LCU obtained by the decoding device from the code stream is not 0, it can determine to start ALF filtering for the LCU, and the decoding device can determine the filter coefficient used by the LCU according to the LCU coefficient identifier of the LCU.
  • the filter coefficient of the LCU is the set of filter coefficients; if the merged region to which the LCU belongs uses multiple sets of filter coefficients filter coefficient, the filter coefficient of the LCU needs to be determined according to the specific value of the LCU coefficient identifier of the LCU.
  • obtaining the filter coefficients of the current LCU based on the region coefficient identifier of the merged region to which the current LCU belongs may include: using multiple sets of filter coefficients when determining the merged region to which the LCU belongs based on the region coefficient identifier of the merged region to which the current LCU belongs.
  • the filter coefficient of the current LCU is determined from multiple sets of filter coefficients used in the merged region to which the LCU belongs.
  • the decoding device may determine the filter coefficient used by the LCU based on the LCU coefficient identifier of the LCU obtained by parsing from the code stream.
  • the filter shapes of the sets of filter coefficients used in the merging region may or may not be exactly the same.
  • An embodiment of the present application provides a filtering method, wherein the filtering method can be applied to a decoding device, and the filtering method can include the following steps:
  • T810 Determine the filter coefficient of the current LCU based on the merged region to which the current LCU belongs and the coefficient selection identifier of the current LCU; wherein the coefficient selection identifier is used to identify the filter coefficient selected and used by the current LCU among the multiple groups of candidate filter coefficients.
  • the LCU in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the LCU is no longer limited to selecting the filter coefficients of the merged region to which it belongs, but can adaptively select a set of filter coefficients from multiple sets of filter coefficients to perform ALF. filter.
  • the candidate filter coefficients of the LCU may include, but are not limited to, the filter coefficients of the merged region to which it belongs and the filter coefficients of the adjacent regions of the merged region to which it belongs. Therefore, in the case where each region transmits a set of filter coefficients , one LCU can have multiple groups of candidate filter coefficients, which improves the flexibility of LCU filter coefficient selection, optimizes the ALF filtering effect, and improves encoding and decoding performance.
  • the encoding device may determine, based on the RDO decision, filter coefficients used by the LCU in multiple sets of candidate filter coefficients, and write the coefficient selection identifier corresponding to the filter coefficient into the code stream and send it to the decoding device.
  • the decoding device may determine the filter coefficient of the current LCU based on the merged region to which the current LCU belongs and the coefficient selection identifier of the current LCU obtained by parsing from the code stream.
  • T820 Perform ALF filtering on the pixels of the current LCU one by one based on the filter coefficients of the current LCU.
  • ALF filtering may be performed on the pixels of the current LCU one by one based on the filter coefficient of the current LCU.
  • multiple groups of candidate filter coefficients are set for each LCU, the filter coefficients used by each LCU are determined based on the RDO decision, and the decision result is notified to the decoding device through the coefficient selection identifier, thereby improving the performance of each LCU.
  • the flexibility of the filter coefficients used can optimize the ALF filtering performance and improve the encoding and decoding performance.
  • determining the filter coefficients of the LCU based on the merged region to which the LCU belongs and the coefficient selection identifier of the LCU may include: when the value of the coefficient selection identifier of the current LCU is a first value, setting the The filter coefficient of the previous merge area of the merge area is determined as the filter coefficient of the previous LCU; when the value of the coefficient selection flag of the current LCU is the second value, the filter coefficient of the merge area to which the current LCU belongs is determined as the filter coefficient of the current LCU ; When the value of the coefficient selection flag of the current LCU is the third value, determine the filter coefficient of the merged region next to the merged region to which the current LCU belongs as the filter coefficient of the current LCU.
  • the candidate filter coefficients of the LCU may include the filter coefficients of the merging region, the filter coefficients of the previous merging region of the merging region, and the latter merging region of the merging region. filter coefficients.
  • the previous merged region of the merged region to which the LCU belongs is the merged region corresponding to the previous adjacent index of the index of the merged region to which the LCU belongs.
  • the next merged region of the merged region to which the LCU belongs is the merged region corresponding to the next adjacent index of the index of the merged region to which the LCU belongs.
  • the latter merged area of merged area 15 can be merged area 0, and the merged area of merged area 0
  • the previous merged region may be region 15 .
  • the encoding device may determine the filter coefficient used by the LCU based on the RDO decision, and when determining the filter coefficient used by the LCU, the filter coefficient of the previous merge area to which the LCU belongs, may determine the filter coefficient of the LCU.
  • the value of the coefficient selection identifier is a first value, such as 0; when the filter coefficient of the merging region to which the LCU belongs is determined, the value of the coefficient selection identifier of the LCU can be determined as a second value, such as 1 ; When determining the filter coefficients of the filter coefficients used by the LCU, the filter coefficients of the merged area after the merged area to which the LCU belongs, it can be determined that the coefficient selection flag of the LCU is a third value, such as 3.
  • the filter coefficient of the previous merged region to which the LCU belongs can be determined. is the filter coefficient of the LCU; when the value of the coefficient selection flag of the LCU obtained by parsing from the code stream is the second value, the filter coefficient of the merged region to which the LCU belongs can be determined as the filter coefficient of the LCU; when from When the value of the coefficient selection flag of the LCU obtained by parsing in the code stream is the third value, the filter coefficient of the merged area after the merged area to which the LCU belongs may be determined as the filter coefficient of the LCU.
  • the filter coefficients of the merged area to which the LCU belongs and the previous merged area and the latter merged area to which the LCU belongs are used as the candidate filter coefficients of the LCU, and a set of filter coefficients are selected based on the RDO decision as the filter coefficients of the LCU , so that in the case of training a set of filter coefficients in one merge area, there may be multiple sets of candidate filter coefficients in the LCU in the merge area.
  • the flexibility of the filter coefficients optimizes the ALF filtering performance and improves the encoding and decoding performance.
  • FIG. 7 is a schematic flowchart of a filtering method provided by an embodiment of the present application, wherein the filtering method may be applied to a decoding device.
  • the filtering method may include the following steps:
  • Step S700 When it is determined that the ALF filtering is started on the current LCU of the current frame image, the filter shape of the merged area to which the current LCU belongs is obtained based on the merged area to which the current LCU belongs.
  • Step S710 Based on the filter shape, obtain the filter coefficient of the merged region to which the current LCU belongs.
  • each area is no longer limited to using the same filter shape, but can selectively use different filter shapes, that is, different filter shapes.
  • the filter shapes used in the merge area can be the same or different.
  • the encoding device may train multiple sets of filter coefficients with different filter shapes, determine the filter shape and filter coefficients used in the merged region based on the RDO decision, and use the filter shape and filter coefficients
  • the write stream is sent to the decoding device.
  • the decoding device when acquiring the filter coefficients of the merging region, can parse the filter shape of the merging region from the code stream, and parse the merging region from the code stream based on the filter shape. Filter coefficients for the region.
  • Step S720 Perform ALF filtering on the pixels of the current LCU one by one based on the filter shape and the filter coefficient.
  • ALF filtering may be performed on the pixels of the current LCU one by one based on the filter coefficient of the current LCU.
  • the decoding device can obtain the filter shape and filter coefficient of each region from the code stream, thereby optimizing the ALF filtering effect and improving the encoding and decoding performance.
  • a filter shape may also be selected for an image frame, or a filter shape may be selected for a component of an image frame (eg, a luminance component and/or a chrominance component).
  • a component of an image frame e.g, a luminance component and/or a chrominance component.
  • image frame A selects a center-symmetric filter shape of 7*7 cross and 5*5 square
  • each LCU in image frame A that enables ALF filtering uses 7*7 cross and 5*5 square.
  • the centrosymmetric filter shape of of .
  • FIG. 8 is a schematic flowchart of a filtering method provided by an embodiment of the present application, wherein the filtering method may be applied to a decoding device.
  • the filtering method may include the following steps:
  • Step S800 When it is determined to start ALF filtering on the current LCU of the current frame image, based on the merged area to which the current LCU belongs, the filter coefficients of the merged area to which the current LCU belongs and the weight coefficients of each reference pixel position are obtained.
  • Step S810 perform ALF filtering on the pixels of the current LCU one by one based on the filter coefficient and the weight coefficient of each reference pixel position.
  • the filters used in the ALF filtering are no longer limited to symmetric filters, but asymmetric filters can be used, that is, the filter coefficients with symmetrical positions can be different , and satisfy a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4, etc.
  • the filter coefficient at the symmetrical position of the filter coefficient is necessary to use the filter coefficient based on the filter coefficient, the filter coefficient at the symmetrical position of the filter coefficient, and the sum of the products of the reference pixels at the corresponding positions, respectively.
  • the filtered pixel value is obtained. Therefore, the above ratio can be used as the ratio between the filter coefficients of the symmetrical position, or, as the pixel value of the reference pixel corresponding to the filter coefficient of the symmetrical position.
  • the ratio of the weighted weight when participating in the ALF filter calculation (It may also be referred to as weight ratio), that is, the above-mentioned asymmetric filter means that the filter coefficients at the symmetrical positions are different, or the weights of the pixel values of the reference pixels corresponding to the filter coefficients at the symmetrical positions are different.
  • the filter coefficient Ci of a 7*7 cross shape plus a 5*5 square center-symmetric filter shape is C28-i
  • Ci: C28-i Ai: (2-Ai )
  • the ratio of the weighted weights of Pi and P28-i when participating in the ALF filtering calculation is Ai: (2-Ai)
  • Pi is the pixel value of the reference pixel position corresponding to Ci
  • P28-i is the corresponding pixel value of C28-i
  • the filtered pixel value of the pixel can be determined in the following manner:
  • Ci is the (i+1)th filter coefficient in the filter coefficients of the merged region to which the LCU belongs
  • Pi is the pixel value of the reference pixel position corresponding to the filter coefficient Ci
  • the pixel position of the current filter pixel is center-symmetric
  • Ai is the weight coefficient of the pixel value of the reference pixel position corresponding to Pi
  • P14 is the pixel value of the current filter pixel
  • C14 is the filter coefficient of the current filter pixel, 0 ⁇ Ai ⁇ 2.
  • the encoding device may determine the filter coefficient and filter performance of the merged region under different weight coefficients corresponding to each position. Select a set of filter coefficients with the best filtering performance, record the filter coefficients and the corresponding weight coefficients at each position of the corresponding filter, and write them into the code stream and send them to the decoding device.
  • a set of weighting coefficients (such as the above-mentioned value set of Ai) may be constructed in advance, and each weighting coefficient may be selected from the set to obtain the filtering coefficient with the best filtering performance and the corresponding filter coefficient at each position of the corresponding filter. weight coefficient, and write the index of the weight coefficient in the weight coefficient set into the code stream and send it to the decoding device.
  • the decoding device can parse the code stream to obtain the filter coefficients of the merged region to which the LCU belongs and the weight coefficients of each reference pixel position corresponding to the merged region to which the LCU belongs, and perform ALF filtering on the pixels of the LCU one by one.
  • the filters used in each merging area are no longer limited to symmetrical filters, and the filter coefficients of reference pixels at symmetrical positions are no longer limited to the same, but can satisfy a certain proportional relationship, and due to the symmetry If the filter coefficients at the positions satisfy the proportional relationship, the number of required filter coefficients will not increase, thereby improving the flexibility of the filter coefficients, optimizing the ALF filtering performance, and improving the encoding and decoding performance.
  • An embodiment of the present application provides a filtering method, which can be applied to an encoding device, and the filtering method can include the following steps:
  • T100 Perform regional division on the luminance component of the current image frame.
  • T110 For any area, classify each LCU in the area, and divide the area into a plurality of area types based on the type of each LCU.
  • the pixel value of each pixel in the region can be determined based on the According to the characteristic, the LCUs in a region are divided into at least one category, that is, a region can be divided into at least one sub-region or region category by means of LCU classification.
  • T120 Perform region merging on each region category, and determine the filter coefficients of each merged region.
  • T130 Write the filter coefficients of each merged region and the region type identifier of each LCU into the code stream.
  • the encoding device when the encoding device classifies the LCUs in each region in the above-mentioned manner, the encoding device may perform region merging on each region category to obtain at least one combined region, and determine the size of each combined region. filter coefficients.
  • region merging for each region category is similar to the relevant description in the "region merging" section above, and will not be repeated here.
  • the encoding device may assign it a coefficient index based on the merged region to which it belongs, where the coefficient index is a filter coefficient corresponding to one of the merged regions.
  • the encoding device may write the filter coefficients of each merged region, the index of each region category, and the region category identifier used to identify the region category to which each LCU belongs, into the code stream, and send it to the decoding device.
  • An embodiment of the present application provides a filtering method, which can be applied to an encoding device, and the filtering method can include the following steps:
  • T200 For any merged region of the current image frame, determine a filter coefficient used in the merged region based on the RDO decision.
  • T210 Determine a region coefficient identifier of the combined region based on the filter coefficient used in the region; wherein the region coefficient identifier is used to identify the filter coefficient used in the combined region among the preset multiple groups of filter coefficients.
  • T220 Write the filter coefficients used in each merging area and the area coefficient identifiers of each merging area into the code stream.
  • the filter coefficients used in a merge area are no longer limited to one set of filter coefficients, and one or more sets of filter coefficients can be selected and used according to actual conditions.
  • the encoding apparatus may train multiple sets of filter coefficients, and determine, based on the RDO decision, that the merged region uses one or more sets of the multiple sets of filter coefficients, and will use to identify the number of filter coefficients used by the merged region.
  • the region coefficient identifies the write stream.
  • the above filtering method may further include: for any merged area of the current image frame, when the filter coefficients used in the merged area include multiple sets, determining the LCU coefficient identifier of each LCU based on the filter coefficients used by each LCU in the merged area; Write the LCU coefficient identifiers of each LCU into the code stream.
  • the encoding device may notify the decoding device to use one or more sets of filter coefficients to merge the regions through the region coefficient identifier.
  • the encoding apparatus may identify the filter coefficient used by the LCU among one or more sets of filter coefficients used in the merged region by using the LCU coefficient identifier.
  • the coding device may notify the filter coefficient used by the LCU in the multiple sets of filter coefficients through the LCU coefficient identifier to the decoding device.
  • the encoding device can write the value of the LCU coefficient identifier of the LCU into the code stream as the first value. For example, assuming that the first value is 0, for any LCU, when the encoding device determines not to start ALF filtering for the LCU, the value of the LCU coefficient identifier of the LCU written in the code stream is 0.
  • An embodiment of the present application provides a filtering method, which can be applied to an encoding device, and the filtering method can include the following steps:
  • T300 for any merged region of the current image frame, determine the filter coefficient used in the merged region from multiple sets of filter coefficients based on the RDO decision;
  • T310 Determine, based on the filter coefficients used in the region, a coefficient selection flag of each LCU in the merged region; wherein the coefficient selection flag is used to identify the filter coefficients selected and used by each LCU among the multiple groups of candidate filter coefficients.
  • T320 Write the filter coefficients used in each merge area and the coefficient selection flags of each LCU into the code stream.
  • the LCU in order to optimize the ALF filtering effect and improve the encoding and decoding performance, the LCU is no longer limited to selecting the filter coefficients of the merged region to which it belongs, but can adaptively select a set of filter coefficients from multiple sets of filter coefficients to perform ALF. filter.
  • the candidate filter coefficients of the LCU may include, but are not limited to, the filter coefficients of the merged region to which it belongs and the filter coefficients of the adjacent regions of the merged region to which it belongs.
  • one LCU can have multiple groups of candidate filter coefficients, which improves the flexibility of LCU filter coefficient selection, optimizes the ALF filtering effect, and improves encoding and decoding performance.
  • the encoding device may determine the filter coefficients used by the LCU in multiple sets of candidate filter coefficients based on the RDO decision, and write the coefficient selection identifiers corresponding to the filter coefficients into the code stream and send it to the decoding device.
  • the candidate filter coefficients of the LCU may include the filter coefficients of the merging region, the filter coefficients of the merging region preceding the merging region, and the filter coefficients of the merging region following the region.
  • the latter merged region of merged region 15 can be merged region 0, merged region
  • the previous merged area of 0 may be merged area 15.
  • the encoding device may determine the filter coefficients used by the LCU based on the RDO decision.
  • the filter coefficients used by the LCU when determining the filter coefficients of the previous merged region to which the LCU belongs, it may determine the coefficient selection flag of the LCU.
  • the value is the first value, such as 0; when the filter coefficient of the merging region to which the LCU belongs is determined, the value of the coefficient selection flag of the LCU can be determined as the second value, such as 1; Filter Coefficient Used by the LCU When the filter coefficient of the merged area after the merged area to which the LCU belongs, the value of the coefficient selection flag of the LCU may be determined to be a third value, such as 3.
  • An embodiment of the present application provides a filtering method, which can be applied to an encoding device, and the filtering method can include the following steps:
  • T400 For any merged region of the current image frame, determine the filter shape and filter coefficient used in the merged region based on the RDO decision.
  • T410 Write the filter shapes and filter coefficients used in combination in each area into the code stream.
  • each merging area is no longer limited to using the same filter shape, but can selectively use different filter shapes, that is, The filter shapes used in different merge regions can be the same or different.
  • the encoding device may train multiple sets of filter coefficients with different filter shapes, determine the filter shape and filter coefficients used in the merged region based on the RDO decision, and use the filter shape and filter coefficients
  • the write stream is sent to the decoding device.
  • a filter shape may also be selected for an image frame, or a filter shape may be selected for a component of an image frame (eg, a luminance component and/or a chrominance component).
  • a component of an image frame e.g, a luminance component and/or a chrominance component.
  • image frame A selects a center-symmetric filter shape of 7*7 cross and 5*5 square
  • each LCU in image frame A that enables ALF filtering uses 7*7 cross and 5*5 square.
  • the centrosymmetric filter shape of of .
  • An embodiment of the present application provides a filtering method, which can be applied to an encoding device, and the filtering method can include the following steps:
  • T500 for any merged area of the current image frame, determine the filter coefficient used by the merged area and the weight coefficient of each corresponding reference pixel position based on the RDO decision;
  • T510 Write the filter coefficients used in each merge area and the corresponding weight coefficients of each reference pixel position into the code stream.
  • the filters used in the ALF filtering are no longer limited to symmetric filters, but asymmetric filters can be used, that is, the filter coefficients with symmetrical positions can be different , and satisfy a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4, etc.
  • the above ratio can be used as the ratio between the filter coefficients at the symmetrical position, or can also be used as the ratio of the weighted weight (also referred to as the weight ratio) when the pixel value of the reference pixel corresponding to the filter coefficient at the symmetrical position participates in the calculation of the ALF filter.
  • the above-mentioned asymmetric filter means that the filter coefficients at the symmetrical positions are different, or the weights of the pixel values of the reference pixels corresponding to the filter coefficients at the symmetrical positions are different.
  • the filtered pixel value of the pixel can be determined in the following manner:
  • Ci is the (i+1)th filter coefficient in the filter coefficients of the merged region to which the LCU belongs
  • Pi is the pixel value of the reference pixel position corresponding to the filter coefficient Ci
  • the pixel position of the current filter pixel is center-symmetric
  • Ai is the weight coefficient of the pixel value of the reference pixel position corresponding to Pi
  • P14 is the pixel value of the current filter pixel
  • C14 is the filter coefficient of the current filter pixel, 0 ⁇ Ai ⁇ 2.
  • Ci:C28-i Ai(2-Ai)
  • the encoding device may determine the filter coefficient and filter performance of the merged region under different weight coefficients corresponding to each position. Select a set of filter coefficients with the best filtering performance, record the filter coefficients and the corresponding weight coefficients at each position of the corresponding filter, and write them into the code stream and send them to the decoding device.
  • a set of weighting coefficients (such as the above-mentioned value set of Ai) may be constructed in advance, and each weighting coefficient may be selected from the set to obtain the filtering coefficient with the best filtering performance and the corresponding filter coefficient at each position of the corresponding filter. weight coefficient, and write the index of the weight coefficient in the weight coefficient set into the code stream and send it to the decoding device.
  • Scheme 1 For each frame, take the LCU as the smallest unit, and adaptively divide it into multiple regions, each of which may include more than one LCU. Therefore, it is proposed to classify each LCU and classify the same region.
  • LCUs are divided into N types, where N is a positive integer.
  • Scheme 2 Multiple sets of filter coefficients can be transmitted in each region, and the shape of each set of filters can be the same or different.
  • a set of filter coefficients is adaptively selected based on each LCU, and LCUs in the same region can select filter coefficients in adjacent regions.
  • Each region can only transmit one set of filter coefficients, but the filter shape of each region can be different.
  • Option 5 Modify the symmetric filter to an asymmetric filter, including optimizing the filter coefficients at the symmetrical positions to be the same so that the filter coefficients at the symmetrical positions satisfy a certain proportional relationship, such as 0.5:1.5 or 0.6:1.4.
  • Scheme 6 Optimize the sample value of the boundary during filtering.
  • the ALF switch sequence header can be obtained to determine whether the current sequence needs to enable ALF technology. If the ALF switch sequence header is off, the ALF technology is turned off, and the ALF optimization technology (that is, the optimization of the traditional ALF technology by the ALF filtering solution provided in the embodiment of the present application) may include any one or more of the above-mentioned solutions 1 to 6. optimization scheme) is also closed, and the ALF switch sequence header is passed to the decoding device. If the ALF switch sequence header is turned on, enter the ALF technology coding, and obtain the ALF technology optimized sequence header.
  • the ALF optimization technology that is, the optimization of the traditional ALF technology by the ALF filtering solution provided in the embodiment of the present application
  • the original ALF technology is used for filtering. Send the ALF switch sequence header, the optimization technology sequence header and the parameters required by the ALF technology to the decoding device.
  • the following scheme can be used for optimization, and the ALF switch sequence header is passed to the decoding device, and the optimized technology sequence header and the parameters required by the optimized ALF technology are passed to the decoding device.
  • the optimized technical sequence header may also not exist. In this case, if the ALF switch sequence header is turned on, it is determined to use the optimized ALF technical solution.
  • the luminance component is divided into fixed regions to obtain multiple regions; for LCUs belonging to the same region, the LCUs are divided again (that is, the LCUs in the same region are classified), and the same region can be further divided into N1 categories at most, and N1 is a positive integer .
  • N1 is a positive integer .
  • the encoding device may mark the result of division of the LCUs in each region, and send it to the decoding device (that is, send the region type identifier of each LCU to the decoding device).
  • n For any merged region, at most n sets of filter coefficients can be passed. And each LCU in the merged area is identified. 0 means off, that is, ALF filtering is not started; i means that the current LCU uses a certain set of filter coefficients in this area, and the value range of i is [1, n].
  • each set of filter coefficients is obtained in the following manner: for the first training of filter coefficients, ALF filtering is enabled by default for all LCUs. For the training of secondary filter coefficients, LCUs with the same label train the same set of filter coefficients together.
  • the training of the third filter coefficient is based on the result of the second decision.
  • the image frame or the combined region uses at most n groups of filter coefficients, and finally the filter coefficients corresponding to each combined region are written into the code stream.
  • Each LCU adaptively selects a set of filter coefficients
  • N2 For the luminance component, for any LCU, you can choose to use the filter coefficients of the area where the current LCU is located or use the filter coefficients of other areas when making a decision. , N2 ⁇ 2), make RDO decision under N2 groups of filter coefficients, select a group of filter coefficients with the best performance, and send the optimal selection result of the current LCU to the decoding device (that is, send the coefficient selection identifier to the decoding device).
  • N2 is less than or equal to the number of merged regions.
  • Each region transmits a set of filter coefficients, so for any LCU, the encoding device can notify the decoding device to enable ALF filtering or not (ie, disable) ALF filtering for this LCU through a flag bit.
  • the filter coefficients under N3 (N3 ⁇ 2) different filter shapes can be calculated separately, and the filtering performance under N3 filter shapes can be calculated separately. Choose the filter shape with the best performance. Then, the filter shape and filter coefficient with the best performance in each region are notified to the decoding device through the code stream.
  • the encoding device may also select filters of different shapes based on the frame level, or select filters of different shapes based on the Y, U, and V components. Taking the selection of filters of different shapes based on the frame level as an example, for any image frame, the filter coefficients of each region under N4 different filter shapes can be calculated separately, and the filter shapes of N4 (N4 ⁇ 2) kinds of filter shapes can be calculated respectively. Under the filter performance of the image frame, select the filter shape with the best performance. Then, the filter shape with the best performance of the image frame and the filter coefficient of each region are notified to the decoding device through the code stream.
  • the filter coefficients at the symmetrical positions satisfy different proportional relationships, so that when performing coefficient training, only training is required. filter coefficients.
  • Ci and C28-i are symmetrical positions.
  • the proportional relationship of the filter coefficients at each symmetrical position can be selected through the RDO decision, and the filter coefficients of each position and the ratio of the filter coefficients of the symmetrical positions are sent to the decoding device through the code stream.
  • the ratio of the filter coefficients of all symmetrical positions is 1:1, the filter obtained by training is still a symmetrical filter.
  • the ALF switch sequence header can be read from the code stream to determine whether the current sequence needs to enable ALF technology. If the ALF switch sequence header is off, the ALF technology is off. If the ALF switch sequence header is turned on, you can continue to read the ALF technology optimized sequence header.
  • the filtering parameters required by the original ALF technology are obtained; if the ALF technology optimized sequence header is on, the filtering parameters required by the optimized ALF technology are read.
  • sequence header of the ALF optimization technique may also not exist. In this case, if the sequence header of the ALF switch is turned on, the filtering parameters required by the optimized ALF technique are read.
  • the luminance component is divided into fixed regions to obtain multiple regions; the filter coefficients of all regions are read from the code stream, and the region category identifiers of all LCUs that enable ALF filtering are read from the code stream. According to the fixed region division results, and The region category identifier of the LCU determines the region category to which the LCU belongs, obtains the corresponding filter coefficient according to the region category to which the LCU belongs, and performs ALF filtering on the pixels of the LCU one by one.
  • Read frame-level or area-level coefficient identifiers from the code stream obtain multiple sets of filter coefficients in each merged area from the code stream according to the frame-level or area-level coefficient identifiers, and determine and select from the frame-level or area-level coefficient identifiers
  • the number of filters that is, the number of filter coefficient groups).
  • the LCU coefficient identifier of each LCU is obtained from the code stream, and a set of filter coefficients is selected according to the LCU coefficient identifier of each LCU.
  • a set of filter coefficients is selected according to the LCU coefficient identifier of each LCU.
  • Each LCU adaptively selects a set of filter coefficients
  • the maximum number of optional filters is N2 (that is, the number of candidate filter coefficients is at most N2 groups).
  • the filter shape of the merged region can be read from the code stream, and the filter coefficient of the merged region can be read according to the filter shape.
  • the filter coefficients of each merged region are read from the code stream, and the scale coefficients of the filter coefficients at the symmetrical positions are read.
  • the filter coefficients at each position and the scale coefficient of the filter coefficients at the symmetrical positions are derived, and the pixels of each LCU in the merged region are ALF filtered one by one.
  • Embodiment 12 Sample value optimization scheme 1 of filtering boundary
  • the filter shape is assumed as shown in Fig. 4A. If the sample used in the adaptive correction filtering process (that is, the reference pixel when filtering the current filter pixel in the adaptive correction filtering unit) is the sample in the adaptive correction filtering unit (that is, the reference pixel is in the adaptive correction filtering unit) If the sample used in the adaptive modification filtering process does not belong to the sample in the adaptive modification filtering unit (that is, the reference pixel is not in the adaptive modification filtering unit), then follow the following method To filter:
  • Embodiment 13 Sample value optimization scheme 2 of filtering boundary
  • the filter shape is assumed as shown in Fig. 4A. If the sample used in the adaptive correction filtering process (that is, the reference pixel when filtering the current filter pixel in the adaptive correction filtering unit) is the sample in the adaptive correction filtering unit (that is, the reference pixel is in the adaptive correction filtering unit) If the sample used in the adaptive modification filtering process does not belong to the sample in the adaptive modification filtering unit (that is, the reference pixel is not in the adaptive modification filtering unit), then follow the following method To filter:
  • Embodiment 14 Sample Value Optimization Scheme 3 of Filtering Boundary
  • the filter shape is assumed as shown in Fig. 4A. If the sample used in the adaptive correction filtering process (that is, the reference pixel when filtering the current filter pixel in the adaptive correction filtering unit) is the sample in the adaptive correction filtering unit (that is, the reference pixel is in the adaptive correction filtering unit) If the sample used in the adaptive modification filtering process does not belong to the sample in the adaptive modification filtering unit (that is, the reference pixel is not in the adaptive modification filtering unit), then follow the following method To filter:
  • EalfEnableFlag encodeable flag bit for enhanced adaptive correction filtering
  • EalfEnableFlag is equal to 0, use the sample closest to the sample in the adaptive correction filtering unit to replace the sample for filtering;
  • EalfEnableFlag If EalfEnableFlag is equal to 1, use the adaptive correction filtering unit and the sample closest to the sample in the boundary area to replace the sample for filtering;
  • EalfEnableFlag refers to a flag whose value can include '1' or '0'. When EalfEnableFlag is equal to 1, it means that enhanced adaptive correction filtering can be used; when EalfEnableFlag is equal to 0, it means that adaptive correction filtering should not be used.
  • the value of EalfEnableFlag may be derived from the decoding end, or obtained from the code stream at the decoding end, and the value of EalfEnableFlag may also be a constant value.
  • EalfEnableFlag can be equal to the value of ealf_enable_flag (that is, the enhanced adaptive correction filtering enable flag); when EalfEnableFlag is equal to 1, it means that enhanced adaptive correction filtering can be used; when EalfEnableFlag is equal to 0, it means that adaptive correction filtering should not be used.
  • Embodiment 15 Sample Value Optimization Scheme 4 of Filtering Boundary
  • the sample cannot obtain the true value, and the current adaptive correction filter unit is used.
  • the sample that is closest to the sample in the filtering unit area is used for filtering instead of the sample.
  • the current adaptive correction filtering unit may use the first filter shown in FIG. 4A for filtering, and the current adaptive correction filtering unit may also use the second filter shown in FIG. 9 for filtering.
  • the current adaptive correction filtering unit uses the first filter shown in FIG. 4A for filtering, and the shape of the filter is shown in FIG. 4A .
  • any sample used in the adaptive correction filtering process (the reference pixel sample when the current filter pixel in the current adaptive correction filtering unit is filtered) is the sample in the current adaptive correction filtering unit, then the sample is directly used for filtering;
  • the filtering is performed as follows:
  • CplfEnableFlag indicates whether to allow cross-patch boundary values, which may also be referred to as cross_patch_loopfilter_enable_flag.
  • the pixel position where the adaptive correction filtering is performed in the current adaptive correction filtering unit is the 14-sample position, and it is necessary to obtain reference pixel samples outside the current adaptive correction filtering unit, as shown in FIG. 4C , as an example , the reference pixel samples 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 are outside the upper boundary of the current adaptive correction filter unit. When the sample values of these positions cannot be obtained, you need to find other sample values instead.
  • the filter sample When the filter sample is in the upper left corner of the current adaptive correction filtering unit, for example, the sample values of the reference pixel samples 1, 2, 6 and 7 cannot be obtained, then the distance within the current adaptive correction filtering unit is used for the sample 1, 2, The sample values of the nearest sample positions 6 and 7 are filtered, and the 14 sample position is the position closest to the four point samples in the current adaptive correction filtering unit. Therefore, the sample values of the 14 sample positions can be replaced as these four points respectively. The values of the samples are filtered.
  • the sample values at positions 4, 5, 9, and 10 of the reference pixel samples cannot be obtained, the sample values at the sample positions closest to 4, 5, 9, and 10 in the current adaptive correction filtering unit are used for filtering.
  • the 15 sample position is In the current adaptive correction filtering unit, the sample positions closest to the 4 and 9 samples can be filtered by using the sample values of the 15 sample positions as the values of the 4 and 9 samples respectively; wherein, the 16 sample positions are in the current adaptive correction filtering unit.
  • the sample values of the 16 sample positions can be filtered as the values of the 5 and 10 samples respectively.
  • the sample value of the reference pixel sample 0, 3, and 8 positions cannot be obtained, and the sample value of the sample position closest to the sample 0, 3, and 8 in the current adaptive correction filtering unit is used for filtering, and the 14 sample position is the current adaptive correction filter.
  • the ALF filtering optimization scheme is described in detail below.
  • Embodiment 16 Adaptive area division with LCU as the smallest unit
  • the fixed area division may be performed according to the manner described in the "area division" section above.
  • the luminance component is divided into 16 regions, each region is marked as K, K ⁇ [0, 15], and there are 1 or more LCUs inside each region.
  • the LCUs belonging to the same area are divided again.
  • the intra-region LCU division method can use the LCU merging method to calculate the cost of merging LCUs in pairs, merging the two LCUs with the smallest cost, and so on, calculate when only [1, N6] classes are left in the merging. For all costs, choose a partitioning method with the smallest cost. Mark each LCU's final selection.
  • each LCU is marked as 1 or 0, that is, the value of the area type identifier of the above LCU includes 1 or 0.
  • the area category to which it belongs is 2K; for the LCU marked as 1 (that is, the value of the area category identifier is 1), the category to which it belongs is 2K. +1.
  • the luminance component is divided into 32 regions at most. After the regions are divided, the 32 regions are merged to calculate the filter coefficient of each merged region.
  • the LCU area division result (that is, the area type identifier of each LCU) and the filter coefficient obtained after the area division are sent to the decoding device through the code stream.
  • a fixed area division can be performed in the manner described in the "area division" section above.
  • the luminance component is divided into 16 regions, and a schematic diagram of the division result is shown in FIG. 2 .
  • the area type identifier of the LCU can be obtained; the LCU whose area type identifier is 0 belongs to the area type 2K; the LCU whose area type is 1 belongs to the area type 2K+1.
  • the filter coefficient of each LCU is determined, and the pixels of each LCU are ALF filtered one by one based on the filter coefficient of each LCU.
  • Embodiment 17 An optimization scheme that can transmit 2 groups of filter coefficients in each region
  • each LCU assuming that 0 means to turn off ALF filtering, 1 means to use the first group of filter coefficients, 2 means to use the second group of filter coefficients, that is, the value of the LCU coefficient identification of the LCU includes 0, 1 or 2.
  • a value is 0, and non-first values include 1 or 2.
  • Coefficients are identified for each region, 0 means only the first set of filter coefficients are used, 1 means only the second set of filter coefficients are used, and 2 means that two sets of filter coefficients are used.
  • the filter shape of the first group of filter coefficients may be as shown in FIG. 4A
  • the filter shape of the second group of filter coefficients may be as shown in FIG. 12 (a 7*7 cross plus the center of a 3*3 square). symmetric filter shape).
  • the filtering parameters use all the pixels of the LCU in the current region. After the decision is made, the first set of coefficients is trained, and only the LCU with the value of 1 is used to participate in the training. When training the second set of coefficients, only the LCU with the value of 2 is used to participate in the training. Finally, through RDO decision, it is determined that only a certain group of filters is used in the current region, or the performance of two groups of filters is used.
  • the value of the regional coefficient flag is 0 or 1; if only the performance of the second group of filter coefficients is optimal, determine the value of the regional coefficient identifier to be 1, write the code stream, and set the The second group of filter coefficients is written into the code stream, and the LCU coefficient identifiers of each LCU are written into the code stream, and the value of the LCU coefficient identifier of each LCU is 0 or 1; if the performance of the two groups of filter coefficients is optimal, then It is determined that the value of the regional coefficient identifier is 2, and the code stream is written, and two sets of filter coefficients are written into the code stream, and the LCU identifier is written into the code stream. The value of the LCU coefficient identifier
  • any merged area read the area coefficient identifier of the merged area from the code stream. If the value of the area coefficient identifier is 0, then the merged area obtains 15 filter coefficients (ie, the first group of filter coefficients); if the area coefficient If the value of the identifier is 1, then the merged area obtains 9 filter coefficients (that is, the second group of filter coefficients); if the value of the area coefficient identifier is 2, then the merged area obtains 9 filter coefficients and 15 filter coefficients respectively .
  • the LCU coefficient identifiers of all LCUs in the merged area are obtained; if the value of the LCU coefficient identifier is 0, it means that the LCU turns off ALF filtering, that is, does not start the LCU. ALF filtering; if the value of the LCU coefficient identifier is 1, it means that the LCU turns on the ALF filtering, that is, the ALF filtering is started for the LCU, and the LCU uses the first group of filtering coefficients.
  • the LCU coefficient identifiers of all LCUs in the merged area are obtained. If the value of the LCU coefficient identifier is 0, it means that the ALF filtering is disabled for the LCU, that is, the ALF filtering is not started for the LCU; The value of the LCU coefficient identifier is 1, which means that the LCU turns on ALF filtering, that is, starts the ALF filtering for the LCU, and the LCU uses the second set of filter coefficients.
  • the LCU coefficient identifiers of all LCUs in the merged area are obtained. If the value of the LCU coefficient identifier is 0, it means that the ALF filtering is disabled for the LCU, that is, the ALF filtering is not enabled for the LCU; The value of the LCU coefficient identifier is 1, which means that the LCU turns on ALF filtering, that is, the ALF filtering is started for the LCU, and the LCU uses the first group of filter coefficients; if the value of the LCU coefficient identifier is 2, it means that the LCU is turned on ALF filtering, that is, enabling ALF filtering for the LCU and using the second set of filter coefficients for the LCU.
  • Embodiment 18 Each LCU adaptively selects a set of filter coefficients
  • each LCU can select up to 3 sets of filter coefficients.
  • the candidate filter coefficients of the LCU include the filter coefficients of the merged region to which the LCU belongs (may be referred to as the filter coefficients of the current merged region), the filter coefficients of the merged region before the merged region to which the LCU belongs (may be referred to as the previous merged region) filter coefficients of one merged region), and filter coefficients of the next merged region of the region to which the LCU belongs (may be referred to as filter coefficients of the latter merged region).
  • the performance under 3 sets of filter coefficients can be calculated respectively, and a set of filter coefficients with the best performance can be selected.
  • the value of the coefficient selection flag of the LCU is 0 (that is, the above first value is 0 as an example);
  • the filter coefficient is the filter coefficient of the current merge area, and the value of the coefficient selection flag of the LCU is 1 (that is, the second value is 1 as an example);
  • the filter coefficient with the best performance is the filter coefficient of the latter merge area, Then, the value of the coefficient selection flag of the LCU is 2 (that is, the above third value is 2 as an example).
  • the candidate filter coefficients of the LCU may include merging
  • the filter coefficients of the region 1, the filter coefficients of the merged region 2, and the filter coefficients of the merged region 3 can be determined based on the RDO decision to determine the filter coefficient with the best performance, and the LCU can be marked based on the decision result.
  • the chrominance component (U component or V component) has only one set of filter coefficients, its LCU may not participate in the selection of filter coefficients, or the LCU of the two chrominance components may select the filter coefficient on the other component, that is, the LCU of the U component.
  • the filter coefficient of the V component can be selected, and the LCU of the V component can select the filter coefficient of the U component.
  • the LCU may not participate in the selection of filter coefficients.
  • the filter coefficients above that is, the LCU of the U component can select the filter coefficient of the V component, and the LCU of the V component can select the filter coefficient of the U component.
  • Embodiment 19 Each region selects filters of different shapes
  • the filter shape can be selected from the filter shape shown in FIG. 4A or FIG. 9 , two or more of the four filter shapes shown in FIG. 11A to FIG. 11D can also be selected, or alternatively Filter shapes other than those shown in FIGS. 4A , 9 , and FIGS. 11A to 11D .
  • N3 sets of filter coefficients can be trained.
  • the filter shapes of the N3 sets of filter coefficients are different.
  • the performance of the merged region using a certain filter shape is calculated, and the one with the best performance is selected.
  • a set of filter coefficients, the corresponding filter shape is sent to the decoding device through the code stream, and the filter coefficient with the best performance in the combined area is sent to the decoding device.
  • the filter shape of the combined region is acquired based on the combined region to which the LCU belongs, and the filter coefficient of the combined region is acquired based on the filter shape.
  • ALF filtering may be performed on the pixels of the current LCU one by one based on the filter coefficient of the current LCU.
  • Embodiment 20 Modify a symmetric filter to an asymmetric filter
  • the weight is 2-Ai.
  • Ai [0.5, 0.6, 0.8, 1.2, 1.4, 1.5, 1].
  • the filtering coefficient and filtering performance of the region can be calculated under different weighting coefficients corresponding to each position.
  • a set of filter coefficients with the best filtering performance is selected, and the filter coefficients and the corresponding weight coefficients at each position of the corresponding filter are recorded.
  • a label (or referred to as an index) for identifying the position of the weight coefficient in the weight coefficient set may be transmitted to the decoding device.
  • the decoding device acquires filter coefficients of each region and weight coefficients corresponding to each filter coefficient.
  • the filtered pixel value of the pixel can be determined by:
  • Ci is the (i+1)th filter coefficient in the filter coefficients of the merged region to which the LCU belongs
  • Pi is the pixel value of the reference pixel position corresponding to the filter coefficient Ci
  • the pixel position of the current filter pixel is centrally symmetric
  • Ai is the weight coefficient of the pixel value of the reference pixel position corresponding to Pi
  • P14 is the pixel value of the current filter pixel
  • C14 is the filter coefficient of the current filter pixel, 0 ⁇ Ai ⁇ 2.
  • Embodiment 21 Each LCU adaptively selects a set of filter coefficients
  • any pixel to be filtered it is taken out in a 3*3 pixel block (3*3 pixel block with the current pixel to be filtered as the center point, and excluding the current pixel to be filtered)
  • the maximum value and the minimum value of the pixel value that is, the maximum value and the minimum value among the pixel values of the 8 pixels except the center position in the 3*3 pixel block centered on the current pixel to be filtered.
  • the maximum or minimum value replaces the pixel value of the current pixel to be filtered to participate in filtering, that is, if the pixel value of the current pixel to be filtered is greater than the maximum value, the The pixel value of the current pixel to be filtered is replaced with the maximum value to participate in the filtering; if the pixel value of the current pixel to be filtered is less than the minimum value, the pixel value of the current pixel to be filtered is replaced with the minimum value to participate in the filtering.
  • Embodiment 22 Adaptive correction filtering and decoding process
  • Adaptive correction filtering enable flag (alf_enable_flag): binary variable. A value of '1' indicates that adaptive correction filtering can be used; a value of '0' indicates that adaptive correction filtering should not be used.
  • the value of AlfEnableFlag is equal to the value of alf_enable_flag.
  • the value of alf_enable_flag can be obtained from the sequence header, that is, before the entire sequence starts to be compressed, a value of '1' indicates that the ALF technology of the entire video sequence is turned on, and a value of '0' indicates that the ALF technology of the entire video sequence is turned off, the sequence header flag.
  • Enhanced adaptive correction filtering enable flag (ealf_enable_flag): a binary variable. A value of '1' indicates that enhanced adaptive correction filtering can be used; a value of '0' indicates that enhanced adaptive correction filtering should not be used.
  • EalfEnableFlag is equal to the value of ealf_enable_flag, and its syntax is described as follows:
  • the enhanced adaptive correction filtering permission flag is read from the code stream, which is the sequence header flag.
  • Picture-level adaptive correction filtering enable flag (picture_alf_enable_flag[compIdx]): a binary variable. A value of '1' indicates that adaptive correction filtering can be used for the compIdx-th component of the current image; a value of '0' indicates that adaptive correction filtering should not be used for the compIdx-th component of the current image.
  • PictureAlfEnableFlag[compIdx] is equal to the value of picture_alf_enable_flag[compIdx]
  • its syntax is described as follows:
  • the image-level adaptive correction filtering enable flag of the three components of Y, U, and V is read from the code stream, which is the image header flag.
  • Image luminance component sample adaptive correction filter coefficient (alf_coeff_luma[i][j]): alf_coeff_luma[i][j] represents the jth coefficient of the ith adaptive correction filter of the luminance component.
  • AlfCoeffLuma[i][j] is equal to the value of alf_coeff_luma[i][j].
  • Image chroma component adaptive correction filter coefficient (alf_coeff_chroma[0][j], alf_coeff_chroma[1][j]): alf_coeff_chroma[0][j] represents the jth adaptive correction filter coefficient of the Cb component, alf_coeff_chroma [1][j] represents the j-th adaptive correction filter coefficient of the Cr component.
  • the value of AlfCoeffChroma[0][j] is equal to the value of alf_coeff_chroma[0][j]
  • the value of AlfCoeffChroma[1][j] is equal to the value of alf_coeff_chroma[1][j].
  • alf_region_distance[i] represents the starting label of the i-th adaptive correction filtering region basic unit of the luminance component and the i-1 adaptive Correct the difference between the starting labels of the basic unit in the filtering area.
  • the value range of alf_region_distance[i] should be 1 to FilterNum-1.
  • alf_region_distance[i] when alf_region_distance[i] does not exist in the bit stream, if i is equal to 0, the value of alf_region_distance[i] is 0; if i is not equal to 0 and the value of alf_filter_num_minus1 is FilterNum-1, then alf_region_distance[i] value of 1.
  • Adaptive Modified Filtering Enable Flag of the Maximum Coding Unit (alf_lcu_enable_flag[compIdx][LcuIndex]): a binary variable.
  • a value of '1' indicates that the samples of the LcuIndex th largest coding unit compIdx component should use adaptive correction filtering; a value of '0' indicates that the samples of the LcuIndex th largest coding unit compIdx component should not use adaptive correction filtering.
  • AlfLCUEnableFlag[compIdx][LcuIndex] is equal to the value of alf_lcu_enable_flag[compIdx][LcuIndex]
  • its syntax is described as follows:
  • the image-level adaptive correction filtering allows the flag to be turned on, then in the chroma, you need to obtain the filter coefficient alf_coeff_chroma on the component; in the luminance, you need to obtain the region merging mode flags alf_region_order_idx, The number of filter coefficients is reduced by 1 (alf_filter_num_minus1), the region merge result alf_region_distance[i], and each filter coefficient alf_coeff_luma.
  • the value of PictureAlfEnableFlag[compIdx] is 0, the value of the offset sample component is directly used as the value of the corresponding reconstructed sample component; otherwise, adaptive correction filtering is performed on the corresponding offset sample component.
  • compIdx equal to 0 represents the luminance component, equal to 1 represents the Cb component, and equal to 2 represents the Cr component.
  • the unit of the adaptive correction filtering is the adaptive correction filtering unit derived from the maximum coding unit, which is processed in sequence according to the raster scan order. Firstly, the adaptive modified filter coefficients of each component are obtained according to the decoding process of the adaptive modified filter coefficients, then the adaptive modified filter coefficients of each component are obtained according to the derived adaptive modified filter unit, according to the adaptive modified filter coefficient index of the luminance component of the current adaptive modified filter unit, and finally according to the adaptive modified filter coefficient index of the luminance component of the adaptive modified filter unit The luminance and chrominance components of the correction filtering unit are subjected to adaptive correction filtering to obtain reconstructed samples.
  • alfCoeffIdxTab[count+1] alfCoeffIdxTab[count]
  • alfCoeffIdxTab[count+1] alfCoeffIdxTab[count]+1
  • alfCoeffIdxTab[i] alfCoeffIdxTab[count]
  • the coefficients AlfCoeffChroma[0][14] and AlfCoeffChroma[1][14] are processed as follows:
  • the adaptive correction filtering unit (as shown in Figure 5) is derived according to the following steps:
  • sample where the upper boundary of the sample area E1 is located belongs to the upper boundary of the image, or belongs to the slice boundary and the value of cross_patch_loopfilter_enable_flag is '0', make the sample area E2 equal to the sample area E1;
  • the upper boundary of the component sample area E1 is extended upwards by four lines to obtain the sample area E2.
  • the first row of samples in the sample area E1 is the upper boundary of the area;
  • the sample area E2 is the current adaptive correction filtering unit.
  • the first row of samples of the image is the upper boundary of the image, and the last row of samples is the lower boundary of the image.
  • the adaptive correction filter coefficient index (referred to as filterIdx) of the current luminance component adaptive correction filter unit is calculated according to the following method:
  • (x, y) is the coordinate in the image of the upper left corner sample of the maximum coding unit that derives the current adaptive correction filter unit, and the regionTable is defined as follows:
  • regionTable[16] ⁇ 0,1,4,5,15,2,3,6,14,11,10,7,13,12,9,8 ⁇
  • the adaptive correction filter coefficient index (denoted as filterIdx) of the current luminance component adaptive correction filter unit is calculated according to the following method.
  • y_interval ((((vertical_size+lcu_height-1)/lcu_height)+4)/8*lcu_height)
  • x_interval ((((horizontal_size+lcu_width-1)/lcu_width)+4)/8*lcu_width)
  • y_cnt Clip3(0,8,(vertical_size+y_interval-1)/y_interval)
  • y_st_offset vertical_size-y_interval*(y_cnt-1)
  • y_st_offset (y_st_offset+lcu_height/2)/lcu_height*lcu_height
  • x_cnt Clip3(0,8,(horizontal_size+x_interval-1)/x_interval)
  • x_st_offset horizontal_size-x_interval*(x_cnt-1)
  • x_st_offset (x_st_offset+lcu_width/2)/lcu_width*lcu_width
  • (x, y) is the coordinate in the image of the upper left corner sample of the maximum coding unit that derives the current adaptive correction filter unit, and the regionTable is defined as follows:
  • regionTable[4][64] ⁇ 63,60,59,58,5,4,3,0,62,61,56,57,6,7,2,1,49,50,55,54, 9,8,13,14,48,51,52,53,10,11,12,15,47,46,33,32,31,30,17,16,44,45,34,35,28, 29,18,19,43,40,39,36,27,24,23,20,42,41,38,37,26,25,22,21 ⁇ , ⁇ 42,43,44,47,48, 49,62,63,41,40,45,46,51,50,61,60,38,39,34,33,52,55,56,59,37,36,35,32,53,54, 57,58,26,27,28,31,10,9,6,5,25,24,29,30,11,8,7,4,22,23,18,17,12,13,2, 3,21,20,19,16,15,14,1,0 ⁇ , ⁇
  • the left boundary of the current adaptive correction filtering unit is the image boundary, or is located outside the slice boundary and the value of CplfEnableFlag is 0, the left boundary does not exist, otherwise the current adaptive correction filtering unit is outside the left boundary. Move 3 sample points to the current Adaptively corrects the area of the filter unit.
  • the right boundary of the current adaptive correction filtering unit is outside the image boundary, or it is located outside the slice boundary and the value of CplfEnableFlag is 0, then the right boundary does not exist, otherwise the area outside the right boundary is the current adaptive correction filtering unit moved left by 3 sample points to The area of the current adaptive correction filter unit.
  • the border area includes a left border area and a right border area.
  • EalfEnableFlag is equal to 0, when the sample used in the adaptive correction filtering process is the sample in the adaptive correction filtering unit, the sample is directly used for filtering; when the sample used in the adaptive correction filtering process does not belong to the adaptive correction filtering process
  • filtering is performed as follows:
  • the adaptive modification filtering operation of the luminance component of the adaptive modification filtering unit is as follows:
  • p(x, y) is the sample after offset
  • p'(x, y) is the reconstructed sample
  • the adaptive correction filtering operation of the chrominance component of the adaptive correction filtering unit is as follows:
  • p(x, y) is the sample after migration
  • p'(x, y) is the reconstructed sample
  • EalfEnableFlag is equal to 1, when the sample used in the adaptive correction filtering process is the sample in the adaptive correction filtering unit, the sample is directly used for filtering; when the sample used in the adaptive correction filtering process does not belong to the adaptive correction filtering process
  • filtering is performed as follows:
  • the adaptive modification filtering operation of the luminance component of the adaptive modification filtering unit is as follows:
  • p(x, y) is the sample after offset
  • p'(x, y) is the reconstructed sample
  • the adaptive correction filtering operation of the chrominance component of the adaptive correction filtering unit is as follows:
  • the image can be divided into fixed regions, and the result of the fixed region division can be shown in Figure 2, and the index value of each region can be obtained.
  • the regions it can be considered to be divided into 8 types as shown in FIG. 15A , or the partial division method shown in FIG. 15A can also be retained, as shown in FIG. 15B .
  • the encoding device may determine the final division mode based on the RDO decision, and transmit the division mode of each region to the decoding device through the code stream.
  • the encoding device may determine the final division mode based on the RDO decision, and transmit the division mode of each region to the decoding device through the code stream.
  • a maximum of 16 areas obtained by the fixed division method can be divided into 64 areas.
  • the decoding device can first perform fixed area division, and then read the specific division method of each area from the code stream to obtain the final division method of the entire frame.
  • the divided area numbers may be as shown in FIG. 15C .
  • the value of J is the maximum index value of the previous region+1.
  • the image width and the number of LCUs included in the high school can be determined according to the image width and the number of LCUs included in the high school. If the fixed area is divided into fixed 4*4 areas, and each area index is shown in Figure 2, when the number of LCUs in width or height is less than 4, there will be areas in some columns or rows that do not contain image information . All these regions that do not contain image information are denoted as set G. The size of the set G is denoted as N7, and N7 is a positive integer.
  • An embodiment of the present application provides a filtering device, wherein the filtering device can be applied to an encoding device or a decoding device, and the device can include a filtering unit, configured to: determine whether the current adaptive modification filtering unit allows the use of enhanced adaptive modification filtering; If it is determined that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, the first filter is used to perform adaptive correction filtering on the current adaptive correction filtering unit; if it is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering If adaptive correction filtering is performed, the second filter is used to perform adaptive correction filtering on the current adaptive correction filtering unit.
  • the first filter may be a center-symmetric filter of 7*7 cross and 5*5 square; the second filter may be a center-symmetric filter of 7*7 cross and 3*3 square.
  • the filtering unit is further configured to, in the process of performing adaptive correction filtering on the current filtering pixels in the current adaptive correction filtering unit, for any reference pixel of the current filtering pixels , when the reference pixel is in the current adaptive correction filtering unit, the pixel value of the reference pixel is used to perform adaptive correction filtering; when the reference pixel is not in the current adaptive correction filtering unit, it is impossible to obtain In the case of the pixel value of the reference pixel, use the pixel closest to the reference pixel position in the current adaptive correction filtering unit to replace the reference pixel to perform adaptive correction filtering. When the pixel value of the reference pixel is obtained Next, use the pixel value of the reference pixel to perform adaptive correction filtering.
  • the situation that the pixel value of the reference pixel cannot be obtained includes one of the following: the reference pixel is outside the image boundary of the current image frame; the reference pixel is outside the slice boundary of the current slice and Filtering across slice boundaries is not allowed; the reference pixel is outside the upper boundary of the current adaptive correction filtering unit; or the reference pixel is outside the lower boundary of the current adaptive correction filtering unit.
  • the filtering unit is further configured to: if it is determined that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, and for performing the adaptive correction filtering of the current adaptive correction filtering unit If the pixel value of the pixel position cannot be obtained, the pixel closest to the reference pixel position in the current adaptive correction filtering unit is used to replace the reference pixel for adaptive correction filtering; if it is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction Filtering, and the pixel value of the pixel position used to perform the adaptive correction filtering of the current adaptive correction filtering unit cannot be obtained, then use the pixel closest to the reference pixel position in the current adaptive correction filtering unit to replace the reference pixel for adaptive Correction filtering.
  • the filtering unit determines whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, including: determining whether to indicate whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering.
  • the value of the flag bit when the value of the flag bit is the first value, it is determined that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, and when the value of the flag bit is the second value, it is determined The current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering.
  • the flag bit used to indicate whether the current adaptive correction filtering unit is allowed to use enhanced adaptive correction filtering is EalfEnableFlag; the value of the EalfEnableFlag is derived from the decoding device, or in the decoding The device obtains the value of the EalfEnableFlag from the code stream, or the value of the EalfEnableFlag is a constant value.
  • obtaining the value of the EalfEnableFlag from the code stream at the decoding device includes: determining the value of the EalfEnableFlag based on the value of the enhanced adaptive correction filtering permission flag parsed from the code stream. Describe the value of EalfEnableFlag.
  • the enhanced adaptive correction filtering permission flag is a sequence level parameter.
  • FIG. 16 is a schematic structural diagram of a filtering apparatus provided by an embodiment of the present application, wherein the filtering apparatus may be applied to an encoding/decoding apparatus, and the apparatus may include a filtering unit 1610 for: In the process of performing ALF filtering on the current filter pixel in the adaptive correction filtering unit, for any reference pixel of the current filtering pixel, when the reference pixel is in the current adaptive correction filtering unit, the pixel of the reference pixel is used.
  • the reference pixel is not in the current adaptive correction filtering unit, in the case that the pixel value of the reference pixel cannot be obtained, use the current adaptive correction filtering unit distance from the The pixel with the closest reference pixel position is used for filtering instead of the reference pixel, and when the pixel value of the reference pixel is obtained, the pixel value of the reference pixel is used for filtering.
  • the situation that the pixel value of the reference pixel cannot be obtained includes one of the following: the reference pixel is outside the image boundary of the current image frame, outside the slice boundary of the current slice, and is not allowed to cross The slice boundary is filtered outside the upper boundary or the lower boundary of the current adaptive modification filtering unit.
  • FIG. 17 is a schematic structural diagram of a filtering apparatus provided by an embodiment of the present application, wherein the filtering apparatus may be applied to an encoding/decoding apparatus, and the apparatus may include a filtering unit 1710, configured to: determine the current Whether the adaptive correction filtering unit allows the use of enhanced adaptive correction filtering; if it is determined that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, use the first filter to perform adaptive correction filtering on the current adaptive correction filtering unit ; If it is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering, use the second filter to perform adaptive correction filtering on the current adaptive correction filtering unit.
  • the first filter is a 7*7 cross and a 5*5 square center-symmetric filter
  • the second filter is a 7*7 cross and a 3*3 square center-symmetric filter.
  • the filtering unit 1710 determines whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, including: determining whether to indicate whether the current adaptive correction filtering unit allows the use of enhanced adaptive correction. The value of the flag bit of the correction filtering, when the flag bit is the first value, it is determined that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, and when the flag bit is the second value, it is determined The current adaptive correction filtering unit does not allow the use of enhanced adaptive correction filtering.
  • the filtering unit 1710 is further configured to: in the process of adaptively correcting and filtering the current filtering pixels in the current adaptive correcting filtering unit, any reference to the current filtering pixels Pixel, when the reference pixel is in the current adaptive correction filtering unit, use the pixel value of the reference pixel to perform adaptive correction filtering; when the reference pixel is not in the current adaptive correction filtering unit, in the inability to In the case of obtaining the pixel value of the reference pixel, use the pixel closest to the reference pixel position in the current adaptive correction filtering unit to replace the reference pixel to perform adaptive correction filtering, and after the pixel value of the reference pixel is obtained. In this case, adaptive correction filtering is performed using the pixel value of the reference pixel.
  • the situation that the pixel value of the reference pixel cannot be obtained includes one of the following: the reference pixel is outside the image boundary of the current image frame, outside the slice boundary of the current slice, and is not allowed to cross The slice boundary is filtered outside the upper boundary or the lower boundary of the current adaptive modification filtering unit.
  • the filtering unit 1710 is further configured to: if it is determined that the current adaptive correction filtering unit allows the use of enhanced adaptive correction filtering, and is used to perform the adaptive correction filtering of the current adaptive correction filtering unit If the pixel value of the pixel position cannot be obtained, the pixel closest to the reference pixel position in the current adaptive correction filtering unit is used to replace the reference pixel for adaptive correction filtering; if it is determined that the current adaptive correction filtering unit does not allow the use of enhanced adaptive correction Filtering, and the pixel value of the pixel position used to perform the adaptive correction filtering of the current adaptive correction filtering unit cannot be obtained, then use the pixel closest to the reference pixel position in the current adaptive correction filtering unit to replace the reference pixel for adaptive Correction filtering.
  • FIG. 18 is a schematic diagram of a hardware structure of a decoding device according to an embodiment of the present application.
  • the decoding apparatus may include a processor 1801, a machine-readable storage medium 1802 having machine-executable instructions stored thereon.
  • the processor 1801 and the machine-readable storage medium 1802 may communicate via a system bus 1803 . And, by reading and executing the machine-executable instructions corresponding to the filtering control logic in the machine-readable storage medium 1802, the processor 1801 can perform the filtering method applied to the decoding apparatus described above.
  • the machine-readable storage medium 1802 referred to herein can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, and the like.
  • the machine-readable storage medium may be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or a combination thereof.
  • a machine-readable storage medium stores machine-executable instructions that, when executed by a processor, implement the above-described application to decoding The filtering method of the device.
  • the machine-readable storage medium may be ROM, RAM, CD-ROM, magnetic tapes, floppy disks, optical data storage devices, and the like.
  • FIG. 19 is a schematic diagram of a hardware structure of an encoding device according to an embodiment of the present application.
  • the encoding apparatus may include a processor 1901, a machine-readable storage medium 1902 having machine-executable instructions stored thereon.
  • the processor 1901 and the machine-readable storage medium 1902 can communicate via a system bus 1903 . And, by reading and executing the machine-executable instructions corresponding to the filtering control logic in the machine-readable storage medium 1902, the processor 1901 can perform the filtering method applied to the encoding apparatus described above.
  • the machine-readable storage medium 1902 referred to herein can be any electronic, magnetic, optical, or other physical storage device that can contain or store information, such as executable instructions, data, and the like.
  • the machine-readable storage medium may be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or a combination thereof.
  • a machine-readable storage medium having machine-executable instructions stored therein, the machine-executable instructions, when executed by a processor, implement the above-described application to encoding The filtering method of the device.
  • the machine-readable storage medium may be ROM, RAM, CD-ROM, magnetic tapes, floppy disks, optical data storage devices, and the like.
  • a camera device including the filtering device in any of the above-mentioned embodiments.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Filtering Materials (AREA)
  • Image Processing (AREA)

Abstract

本申请提供一种滤波方法、装置及设备。根据一个示例,该滤波方法包括:确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波;若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,则使用第一滤波器对所述当前自适应修正滤波单元进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,则使用第二滤波器对所述当前自适应修正滤波单元进行自适应修正滤波。其中,所述第一滤波器为7*7十字形加5*5方形的中心对称滤波器;所述第二滤波器为7*7十字形加3*3方形的中心对称滤波器。

Description

用于滤波的方法、装置及设备 技术领域
本申请涉及视频编解码技术,尤其涉及用于滤波的方法、装置及设备。
背景技术
完整的视频编码一般包括预测、变换、量化、熵编码、滤波等操作。在基于块的运动补偿后存在量化操作,由此产生了编码噪声,造成视频质量失真。通常,环路后处理技术可用于降低此类失真的影响。然而实践发现,现有环路后处理技术的滤波性能较差。
发明内容
有鉴于此,本申请提供一种滤波方法、装置及设备。具体地,本申请是通过如下技术方案实现的:
根据本申请实施例的第一方面,提供一种滤波方法,应用于编码/解码设备,所述方法包括:确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波;若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,使用第一滤波器对所述当前自适应修正滤波单元进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,使用第二滤波器对所述当前自适应修正滤波单元进行自适应修正滤波。其中,所述第一滤波器为7*7十字形加5*5方形的中心对称滤波器;所述第二滤波器为7*7十字形加3*3方形的中心对称滤波器。
结合第一方面,在第一种可能的实现方式中,确定所述当前自适应修正滤波单元是否允许使用增强自适应修正滤波,包括:确定用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位取值,在所述标志位取值为第一取值时确定当前自适应修正滤波单元允许使用增强自适应修正滤波,在所述标志位取值为第二取值时确定当前自适应修正滤波单元不允许使用增强自适应修正滤波。其中,所述用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位可为EalfEnableFlag;所述EalfEnableFlag的值可从所述解码设备导出,或在所述解码端设备处可由码流中获取所述EalfEnableFlag的值,或所述EalfEnableFlag的值为一个常值。在所述解码端设备处由码流中获取所述EalfEnableFlag的值,可包括:基于从所述码流中解析得到的增强自适应修正滤波允许标志的值确定所述EalfEnableFlag的值,所述增强自适应修正滤波允许标志可为序列级参数。
结合第一方面,在第二种可能的实现方式中,所述方法还包括:在对当前自适应修正滤波单元内的当前滤波像素进行自适应修正滤波的过程中,对于所述当前滤波像素的任一参考像素,当该参考像素处于所述当前自适应修正滤波单元内时,使用该参考像素的像素值进行自适应修正滤波;当该参考像素未处于所述当前自适应修正滤波单元内时,在无法获取到该参考像素的像素值的情况下,使用所述当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波,在获取到该参考像素的像素值的情况下,使用该参考像素的像素值进行自适应修正滤波。
结合第一方面的第二种可能的实现方式,在第三种可能的实现方式中,所述无法获取到该参考像素的像素值的情况包括以下之一:该参考像素处于当前图像帧的图像边界外、处于当前片的片边界外且不允许跨越片边界进行滤波、处于所述当前自适应修正滤波单元的上边界外或下边界外。
结合第一方面的第二种可能的实现方式或第一方面的第三种可能的实现方式,在第四种可能的实现方式中,所述方法还包括:若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代 替该参考像素进行自适应修正滤波。
根据本申请实施例的第二方面,提供一种滤波装置,应用于编码/解码设备,所述装置包括:滤波单元,用于确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波;所述滤波单元,还用于若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,使用第一滤波器对所述当前自适应修正滤波单元进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,使用第二滤波器对所述当前自适应修正滤波单元进行自适应修正滤波。其中,所述第一滤波器为7*7十字形加5*5方形的中心对称滤波器;所述第二滤波器为7*7十字形加3*3方形的中心对称滤波器。
结合第二方面,在第一种可能的实现方式中,所述滤波单元确定所述当前自适应修正滤波单元是否允许使用增强自适应修正滤波,包括:确定用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位取值,在所述标志位取值为第一取值时确定当前自适应修正滤波单元允许使用增强自适应修正滤波,在所述标志位取值为第二取值时确定当前自适应修正滤波单元不允许使用增强自适应修正滤波。其中,所述用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位可为EalfEnableFlag;所述EalfEnableFlag的值可从所述解码设备导出,或在所述解码端设备处可由码流中获取所述EalfEnableFlag的值,或所述EalfEnableFlag的值为一个常值。在所述解码端设备处由码流中获取所述EalfEnableFlag的值,可包括:基于从所述码流中解析得到的增强自适应修正滤波允许标志的值确定所述EalfEnableFlag的值,所述增强自适应修正滤波允许标志可为序列级参数。
结合第二方面,在第二种可能的实现方式中,所述滤波单元,还用于在对当前自适应修正滤波单元内的当前滤波像素进行自适应修正滤波的过程中,对于所述当前滤波像素的任一参考像素,当该参考像素处于所述当前自适应修正滤波单元内时,使用该参考像素的像素值进行自适应修正滤波;当该参考像素未处于所述当前自适应修正滤波单元内时,在无法获取到该参考像素的像素值的情况下,使用所述当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波,在获取到该参考像素的像素值的情况下,使用该参考像素的像素值进行自适应修正滤波。
结合第二方面的第二种可能的实现方式,在第三种可能的实现方式中,所述无法获取到该参考像素的像素值的情况包括以下之一:该参考像素处于当前图像帧的图像边界外、处于当前片的片边界外且不允许跨越片边界进行滤波、处于所述当前自适应修正滤波单元的上边界外或下边界外。
结合第二方面的第二种可能的实现方式或第二方面的第三种可能的实现方式,在第四种可能的实现方式中,所述滤波单元,还用于:若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波。
根据本申请实施例的第三方面,提供一种解码设备,包括处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令,所述处理器用于执行机器可执行指令,以实现上述第一方面提供的滤波方法。
根据本申请实施例的第四方面,提供一种编码设备,包括处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令,所述处理器用于执行机器可执行指令,以实现上述第一方面提供的滤波方法。
本申请实施例的滤波的方法,通过确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波,并在确定当前自适应修正滤波单元允许使用增强自适应修正滤波时, 使用第一滤波器对所述当前自适应修正滤波单元进行自适应修正滤波;在确定当前自适应修正滤波单元不允许使用增强自适应修正滤波时,使用第二滤波器对所述当前自适应修正滤波单元进行自适应修正滤波,提高了滤波器选择的灵活性,优化了滤波效果,提升了编解码性能。
附图说明
图1A和图1B示出视频编解码的流程示意图;
图2是一种区域划分的示意图;
图3是一种区域合并的示意图;
图4A是一种7*7十字形加上5*5方形的中心对称滤波器形状的示意图;
图4B是图4A所示滤波器对应的参考像素的示意图;
图4C是一种对当前自适应修正滤波单元进行滤波的参考像素位置的示意图;
图5是本申请一示例性实施例示出的一种样本滤波补偿单元的示意图;
图6A是本申请一示例性实施例示出的一种滤波方法的流程示意图;
图6B是本申请一示例性实施例示出的一种滤波方法的流程示意图;
图7是本申请一示例性实施例示出的一种滤波方法的流程示意图;
图8是本申请一示例性实施例示出的一种滤波方法的流程示意图;
图9是一种7*7十字形加上3*3方形的中心对称滤波器形状的示意图;
图10是本申请一示例性实施例示出的一种合并区域的示意图;
图11A至图11D是本申请一示例性实施例示出的多种不同滤波器形状的示意图;
图12是本申请一示例性实施例示出的一种3*3像素块的示意图;
图13是本申请一示例性实施例示出的一种滤波系数不对称的滤波器的示意图;
图14A是本申请一示例性实施例示出的一种参考像素位置的示意图;
图14B是本申请一示例性实施例示出的另一种参考像素位置的示意图;
图15A和图15B是本申请一示例性实施例示出的多种对固定区域划分方式得到的区域进行二次划分的示意图;
图15C是本申请一示例性实施例示出图15A中各二次划分方式对应的区域编号示意图;
图16是本申请一示例性实施例示出的一种滤波装置的结构示意图;
图17是本申请一示例性实施例示出的一种滤波装置的结构示意图;
图18是本申请一示例性实施例示出的一种解码设备的硬件结构示意图;
图19是本申请一示例性实施例示出的一种编码设备的硬件结构示意图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。
在本申请使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本申请。在本申请和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。
下面先对本申请实施例涉及的技术术语、现有视频编解码的主要流程以及ALF滤波技术的实现进行简单说明。
一、技术术语
1、率失真原则(Rate-Distortion Optimized,简称RDO):评价编码效率的指标包括码率和峰值信噪比(Peak Signal to Noise Ratio,简称PSNR)。码率越小,则压缩率越大;PSNR越大,重建图像质量越好。在模式选择的时候,判别公式实质上也就是对二者的综合评价。
模式对应的代价:J(mode)=D+λ*R。其中,D表示失真(Distortion),通常使用SSE(差值均方和)指标来衡量,SSE是指重建块与源图像块的差值均方和;λ是拉格朗日乘子;R是该模式下图像块编码所需的实际比特数,包括编码模式信息、运动信息、残差等所需的比特总和。在模式选择时,若使用RDO原则去对编码模式做比较决策,通常可保证编码性能最佳。
2、编码树(Coding Tree Unit,简称CTU):传统的视频编码都是基于宏块实现的,对于4:2:0采样格式的视频,一个宏块包含一个16×16大小的亮度块和两个8×8大小的色度块。考虑到高清视频/超清视频的自身特性,通用视频编码(Versatile Video Coding,简称VVC)中引入了CTU,其尺寸由编码器指定,允许大于宏块尺寸。同一位置的一个亮度树形编码单元(Coding Tree Block,简称CTB)和两个色度CTB,再加上相应的语法元素形成一个CTU。在VVC中对于一个L×L大小的亮度CTB,L∈{8,16,32,64,128}。
亮度CTB大小取值范围是{8×8,16×16,32×32,64×64,128×128}
色度CTB大小取值范围是{4×4,8×8,16×16,32×32,64×64}
在高分辨率视频编码过程中,使用较大的CTB可获得更好的压缩效果。
3、去方块滤波(Deblocking Filter,简称DBF):图像编码过程是基于不同的块进行的,每个块内进行着相对独立的编码。由于每个块使用不同的参数,块内的分布特性相互独立,造成了在块的边缘存在不连续的现象,可称之为方块效应。去方块滤波主要对块的边界进行平滑,以去除方块效应。
4、样值偏移补偿(Sample Adaptive Offset,简称SAO):指从像素域入手,根据重构图像的特点,将其划分类别,然后在像素域进行补偿处理。主要为了降低振铃效应。
5、自适应修正滤波(Adaptive Leveling Filter,简称ALF):应用在DB与SAO之后,主要为了进一步在客观条件下提升图像质量。ALF技术根据参考像素的特点,构建一个以最小二乘为基础的多元线性回归模型,在像素域上进行滤波补偿。
示例性的,环路后处理技术可包括DBF、SAO以及ALF。
6、维纳滤波器(wiener filtering):本质是使估计误差(定义为期望响应与滤波器实际输出之差)均方值最小化。
二、视频编解码的主要流程
请参考图1A,以视频编码为例,视频编码一般包括预测、变换、量化、熵编码等过程。进一步地,编码过程可按照图1B的框架来实现。
其中,预测可分为帧内预测和帧间预测。帧内预测是利用周围已编码块作为参考对当前未编码块进行预测,有效去除空域上的冗余。帧间预测是使用邻近已编码图像对当前图像进行预测,有效去除时域上的冗余。
变换是指将图像从空间域转换至变换域,利用变换系数对图像加以表示。绝大多数图像都含有较多的平坦区域和缓慢变化的区域,适当的变换可使图像由在空间域的分散分布转换为在变换域的相对集中分布。换言之,变换可去除信号之间的频域相关性,并通过配合量化过程,可有效压缩码流。
熵编码是一种无损编码方式,可把一系列元素符号转变为一个用来传输或存储的二进制码流,输入的符号可能包括量化后的变换系数、运动矢量信息、预测模式信息,变换量化相关语法等。熵编码可有效地去除视频元素符号的冗余。
视频解码与视频编码的过程是相对的,即视频解码通常包括熵解码、预测、反量化、反变换、滤波等过程,且视频解码中的各个过程的实现原理与视频编码中的相同或相似。三、ALF滤波技术的实现
在音视频编码标准(Audio Video coding Standard,简称AVS)框架中使用的ALF技术,根据维纳滤波的原理计算原始信号和失真信号在均方意义下能达到的最优线性滤波。
ALF编码流程可包括:区域划分→获取参考像素→区域合并并计算滤波系数→决策判断每个LCU是否启动滤波。整个过程中需要计算获取的参数有:1)、滤波参数个数;2)、区域合并标识;3)、每组滤波系数;4)、LCU是否启动滤波标识;5)、当前分量(Y,U,V)是否启动滤波标识。
下面对ALF滤波过程中部分处理和概念进行详细说明。
1、区域划分
在ALF流程中,对于获取到的重建视频数据,对其亮度分量上的数据进行分区处理,对其色度分量上的数据进行非分区处理。
示例性的,区域划分的具体实现过程可为:将图像分割为16个大小基本相等且基于LCU对齐的区域。非最右区域宽度为(((pic_width_InLcus+1)/4)×Lcu_Width),其中pic_width_InLcus表示图像宽度上的LCU个数,Lcu_Width表示每个LCU的宽。最右区域宽度为图像宽度与非最右三个区域宽的差(图像宽度减去非最右三个区域的总宽度)。
同理,非底部区域的高度为(((pic_height_InLcus+1)/4)×Lcu_Height),其中pic_height_InLcus表示图像高度上的LCU个数,Lcu_Height表示每个LCU的高度。最底部区域的高度为图像高度与非底部三个区域高的差(图像高度减去非最底部三个区域的总高度)。
得到整张图的区域划分结果后,为每个区域分配一个索引值,示例可如图2所示。2、区域合并
区域合并操作是指根据索引值顺序判断相邻区域是否合并。合并的目的是为了减少编码系数。需要使用一个合并标识,用于表示当前区域是否与相邻区域合并。
举例来说,按照上述进行区域划分之后,共包括16个区域(可称为16类或16组(groups),索引值依次为0~15),在第一次合并时,可依次尝试对区域0和区域1进行合并、区域1和区域2进行合并、区域2和区域3进行合并、…、区域13和区域14进行合并、区域14和区域15进行合并,并按照误差最小的合并方式进行第一次区域合并,从而16个区域合并成为15个区域。
对于第一次合并后的15个区域(假设区域2和区域3进行合并,得到区域2+3),依次尝试对区域0和区域1进行合并、区域1和区域2+3进行合并、区域2+3和区域4进行合并、…、区域13和区域14进行合并、区域14和区域15进行合并,并按照误差最小的合并方式进行第二次区域合并,从而15个区域合并成为14个区域。
对于第二次合并后的14个区域(假设区域14和区域15进行合并,得到区域14+15,即合并区域包括区域2+3以及区域14+15),依次尝试对区域0和区域1进行合并、区域1和区域2+3进行合并、区域2+3和区域4进行合并、…、区域12和区域13进行合并、区域13和区域14+15进行合并,并按照误差最小的合并方式进行第三次区域合并,从而14个区域合并成为13个区域。
以此类推,直至合并为1个区域,其示意图可如图3所示。
完成上述区域合并操作之后,可依次在未进行区域合并(共16个区域)、进行了一次区域合并(共15个区域)、…、进行了14次区域合并(共2个区域)、进行15次区域合并(共1个区域)的情况下,计算对整帧图像进行维纳滤波的误差,并将误差最小的区域合并方式确定为最终的区域合并方式。
3、参考像素、滤波系数
按照上述方式进行区域划分之后,可基于各区域中各像素的参考像素,按照维纳滤波原理计算滤波系数。
对于参与滤波的所有像素点,分别以每个像素点作为当前像素,在以该像素点为中心的一定范围内取周围像素点作为参考像素,将参考像素与当前像素作为输入,以该像素点的原始值作为目标,用最小二乘法计算滤波系数。
请参见图4A,为一种滤波器形状的示意图。如图4A所示,为一种7*7十字形加上5*5方形的中心对称滤波器形状,该滤波器对应的参考像素可参见图4B。
如图4B所示,中心对称滤波器P0和P28的滤波系数一样,因此在编码端训练的时候,分别获取(Pi+P28-i,i=0,…,13)作为同一个特征进行输入,P14作为一个特征进行输入,训练15个滤波系数。即参考像素的选取为:
E[i]=(Pi+P28-i)
E[14]=P14
其中,Pi属于滤波前重建图像中的像素,E[i]为参考像素的值,i=0,1,2,3,4,5,6,7,8,9,10,11,12,13。
维纳滤波的目标是对当前像素周围的参考像素值的线性组合,使其逼近于原图的当前像素值。
ALF技术是基于最大编码单元(Largest Coding Unit,简称LCU)进行处理的。属于同一个合并后的区域的LCU使用同一组滤波系数进行滤波。
4、自适应修正滤波单元
如图5所示,根据当前最大编码单元按下列步骤导出自适应修正滤波单元:
4.1、将当前最大编码单元C所在样本区域超出图像边界的部分删除,得到样本区域D;
4.2、若样本区域D的下边界所在的样本不属于图像的下边界,则将亮度分量和色度分量样本区域D的下边界向上收缩四行,得到样本区域E1;否则,令样本区域E1等于样本区域D;样本区域D的最后一行样本为区域的下边界;
4.3、若样本区域E1的上边界所在的样本属于图像的上边界,或者属于片边界且cross_patch_loopfilter_enable_flag的值为‘0’,令样本区域E2等于样本区域E1;否则,将亮度分量和色度分量样本区域E1的上边界向上扩展四行,得到样本区域E2;样本区域E1的第一行样本为区域的上边界;
4.4、将样本区域E2作为当前自适应修正滤波单元;图像的第一行样本为图像的上边界,图像的最后一行样本为图像的下边界。
5、自适应修正滤波操作
当确定对当前自适应滤波单元进行滤波时,自适应修正滤波过程中用到的参考像素为自适应修正滤波单元内的样本,则直接使用该样本进行滤波;
若自适应修正滤波过程中用到的样本为自适应修正滤波单元内的样本,则直接使用该样本进行滤波;否则,按照如下方式进行滤波:
5.1、若该样本在图像边界外,或在片边界外且cross_patch_loopfilter_enable_flag的值为‘0’,即不允许跨越片边界进行滤波,则使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;
5.2、若该样本在自适应修正滤波单元上边界外或下边界外,则使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;
5.3、若该样本未在自适应修正滤波单元上边界外,也未在自适应修正滤波单元下边界外,直接使用该样本进行滤波。
6、决策是否启动ALF
对于编码设备,区域合并计算得到各区域的滤波系数后,需要进行决策,即以LCU为基本单位判断当前图像中每一个LCU是否使用ALF。
编码设备可计算当前LCU打开与关闭前后的率失真代价,来决定当前LCU是否使用ALF。若当前LCU被标记为使用ALF,则对LCU内的每个像素进行维纳滤波。
相关技术中,ALF技术针对每个区域只传递一套固定的滤波系数,且滤波器形状是固定不变的。因此可能存在一些问题,如:固定划分的区域不能将相同特性的像素划分为相同类别,或者使用的滤波器形状不合适。同时,划分好的每个区域最多传递一套 滤波系数,对于较大的区域或者图像纹理较复杂的区域而言,一套滤波系数是不够的。
为了优化ALF滤波效果,提高编解码性能,本申请实施例提出如下优化方案:
方案1、对于每一帧,以LCU为最小单位,将其自适应划分为多个区域,每个区域可能包括不止一个LCU,因此,提出对每个LCU进行分类,将同一个区域的LCU分为N类,N为正整数。示例性的,若各区域内的LCU均划分为同一分类,则对应传统ALF方案的固定区域划分方案。为了区别于传统ALF方案的固定区域划分方式,N≥2。
方案2、每个区域中可传递多组滤波系数,每组滤波器形状可相同也可不同。
方案3、基于每个LCU自适应的选择一套滤波系数,同一个区域的LCU可选择相邻区域的滤波系数。
方案4、每个区域只能传递一组滤波系数,但每个区域的滤波器形状可不相同。
方案5、将对称滤波器修改为非对称滤波器,包括将对称位置的滤波系数相同优化为对称位置上滤波系数满足一定的比例关系,如0.5:1.5或0.6:1.4等。
方案6、对于滤波时边界的样本取值,进行优化。
为了使本申请实施例的上述目的、特征和优点能够更加明显易懂,下面结合附图对本申请实施例中技术方案作进一步详细的说明。
下文中以在LCU的尺寸下采用本申请实施例提供的方案进行ALF滤波为例,但本申请实施例中也可使用其他尺寸或表示图像块的方法替代,例如N*M大小的图像块,N为小于或等于图像帧的宽度的正整数,M小于或等于图像帧的高度的正整数。
实施例一
本申请实施例提供了一种滤波方法,其中,该滤波方法可应用于解码设备,该滤波方法可包括以下步骤:
T600、对当前图像帧的亮度分量进行区域划分。
对图像帧的亮度分量的区域划分可参见上文中“区域划分”部分的相关说明。
T610、基于从码流中解析得到的LCU的区域类别标识,确定LCU所属区域类别。
为了优化ALF滤波效果,提高编解码性能,当按照固定区域划分方式对图像帧的亮度分量进行区域划分得到多个区域时,对于各区域,可基于区域内各像素的像素特性,将区域内的LCU划分为至少一个类别,即一个区域可通过LCU分类的方式被划分为至少一个子区域或区域类别。对于任一LCU,可基于该LCU所属区域以及该LCU在所属区域内的类别,确定其所属区域类别。示例性的,编码设备向解码设备发送码流时,可将用于标识各LCU所属区域类别的区域类别标识携带在码流中发送给解码设备。对于任一LCU,解码设备可从码流中解析该LCU的区域类别标识,并基于解析得到的该LCU的区域类别标识,确定该LCU所属区域类别。
T620、基于LCU所属区域类别以及从码流中解析得到的滤波系数,确定LCU的滤波系数。
本申请实施例中,当按照上述方式对各区域内的LCU进行了分类时,编码设备可对各区域类别进行区域合并,得到至少一个合并后的区域(可称为合并区域),并确定各合并区域的滤波系数。对各区域类别进行区域合并的实现方式,与上文中“区域合并”部分中的相关说明相类似,在此不做赘述。
示例性的,对于任一区域类别,编码设备可基于其所属合并区域为其分配一个系数索引,该系数索引该对应其中一个合并区域的滤波系数。
编码设备可将各合并区域的滤波系数以及各区域类别的索引写入码流,并发送给解码设备。
示例性的,对于任一LCU,解码设备可基于该LCU所属区域类别,确定该LCU所属区域类别的系数索引,并基于该系数索引以及从码流中解析得到的滤波系数,确定该LCU的滤波系数。
T630、基于LCU的滤波系数对LCU的像素逐个进行ALF滤波。
本申请实施例中,对于任一LCU,当确定了该LCU的滤波系数时,可基于该LCU的滤波系数对LCU的像素逐个进行ALF滤波。
可见,通过对按照固定区域划分方式划分得到的区域内的LCU进行分类,使区域划分更符合各LCU的像素特性,从而,可优化ALF滤波效果,提升编解码性能。
在一个实施例中,T610中,基于从码流中解析得到的LCU的区域类别标识,确定LCU所属区域类别,包括:基于LCU所属区域以及LCU的区域类别标识,确定LCU所属区域类别。
示例性的,对于任一LCU,可基于该LCU所属区域(按照固定区域划分方式得到的区域)以及该LCU的区域类别标识,确定该LCU所属区域类别。
在一个示例中,LCU的区域类别标识用于标识LCU在LCU所属区域内的类别,LCU在该LCU所属区域内的类别通过对LCU所属区域内各LCU进行分类确定;
上述基于LCU所属区域以及LCU的区域类别标识,确定LCU所属区域类别,可包括:基于各区域的类别数量、LCU所属区域、以及LCU的区域类别标识,确定LCU所属区域类别。
对于任一LCU,解码设备可基于从码流中解析得到的该LCU的区域类别标识,确定该LCU在其所属区域内的类别。举例来说,假设一个区域内的LCU最多被划分为2类,对于被划分为第一类的LCU,其区域类别标识可为0;对于被划分为第二类的LCU,其区域类别标识可为1。
对于任一区域内的任一LCU,当从码流中解析得到的该LCU的区域类别标识的取值为0时,可确定该LCU在该区域内的类别为第一类;当从码流中解析得到的该LCU的区域类别标识的取值为1时,可确定该LCU在该区域内的类别为第二类。
示例性的,对于任一LCU,解码设备可基于各类别的类别数量、该LCU所属区域、以及LCU的所属区域类别,确定该LCU所属区域类别。
作为一种示例,上述基于各区域的类别数量、LCU所属区域、以及LCU的区域类别标识,确定LCU所属区域类别,可包括:基于LCU所属区域之前的各区域的类别数量,确定LCU所属区域之前各区域的类别的总数;基于LCU所属区域之前各区域的类别的总数以及LCU的区域类别标识,确定LCU所属区域类别。
示例性的,对于任一LCU,可基于各区域的类别数量,确定LCU所属区域之前的各区域的类别的总数,并基于该LCU所属区域之前各区域的类别的总数以及LCU的区域类别标识,确定LCU所属区域类别。
举例来说,假设当前图像帧的亮度分别共被划分为L个区域,各区域内的LCU均被划分为N个类别,则对于区域K内的任一LCU,当从码流中解析得到的该LCU的区域类别标识的取值为m时,可确定该LCU所属区域类别为N*K+m;其中,m∈[0,N-1],N≥1,K∈[0,L-1]。
在一些实施例中,T620中,基于LCU所属区域类别以及从码流中解析得到的滤波系数,确定LCU的滤波系数之前,还可包括:确定是否对LCU启动ALF滤波;当确定对LCU启动ALF滤波时,确定执行上述基于LCU所属区域类别以及从码流中解析得到的滤波系数,确定LCU的滤波系数的操作。
对于任一LCU,编码设备可基于RDO决策确定是否对该LCU启动ALF滤波。
解码设备在对LCU进行ALF滤波之前,可先确定是否对该LCU启动ALF滤波。例如,解码设备可基于从码流中解析得到的用于标识是否对该LCU启动ALF滤波的标识,来确定是否对该LCU启动ALF滤波。
当解码设备确定对LCU启动ALF滤波时,可按照上述实施例中描述的方式基于LCU所属区域类别以及从码流中解析得到的滤波系数,确定LCU的滤波系数。
在一个示例中,上述确定是否对所述LCU启动ALF滤波,可包括:从码流中解析LCU的LCU系数标识;其中,LCU系数标识用于标识在LCU所属合并区域使用的至 少一组滤波系数中,LCU使用的滤波系数;当LCU的LCU系数标识的取值为非第一值时,确定对LCU启动ALF滤波。
示例性的,为了优化ALF滤波效果,提高编解码性能,一个合并区域使用的滤波系数不再限制于一组滤波系数,而是可根据实际情况选择使用一组或多组滤波系数。
示例性的,对于任一合并区域,编码设备可训练多组滤波系数,并基于RDO决策确定该合并区域使用其中一组滤波系数或多组滤波系数。对于该区域的任一LCU,编码设备可通过LCU系数标识来标识该合并区域使用的一组或多组滤波系数中,该LCU使用的滤波系数。
对于任一LCU,当该LCU的LCU系数标识的取值为第一值时,表明不对该LCU启动ALF滤波。
对于任一LCU,当解码设备从码流中解析到的该LCU的LCU系数标识的取值为非第一值时,可确定对该LCU启动ALF滤波。
举例来说,假设第一值为0,则对于任一LCU,当解码设备从码流中解析得到该LCU的LCU系数标识的取值为0时,可确定不对该LCU启动ALF滤波;当解码设备从码流中解析得到的该LCU的LCU系数标识不是0时,可确定对该LCU启动ALF滤波,并可根据该LCU的LCU系数标识确定该LCU使用的滤波系数。
当LCU的LCU系数标识的取值为非第一值时,若该LCU所属合并区域使用一组滤波系数,则该LCU的滤波系数即为该组滤波系数;若该LCU所属合并区域使用多组滤波系数,则还需要根据该LCU的LCU系数标识的具体取值确定该LCU的滤波系数。
在一个示例中,基于LCU所属区域类别以及从码流中解析得到的滤波系数,确定LCU的滤波系数,可包括:基于LCU所属区域类别、从码流中解析得到的滤波系数以及从码流中解析得到LCU所属合并区域的区域系数标识,确定LCU的滤波系数。区域系数标识用于标识在预设多组滤波系数中,LCU所属合并区域使用的滤波系数。
示例性的,对于任一合并区域,编码设备可训练多组滤波系数,并基于RDO决策确定该合并区域使用该多组滤波系数中的一组或多组,并将用于标识该合并区域使用的滤波系数的区域系数标识写入码流。
示例性的,对于任一合并区域的任一LCU,解码设备可基于从码流中解析得到的该合并区域的区域系数标识,确定该合并区域使用的滤波系数。
举例来说,假设预设多组滤波系数包括两组滤波系数(假设为滤波系数A和滤波系数B),对于任一合并区域,当编码设备确定该合并区域使用滤波系数A时,编码设备确定该合并区域的区域系数标识的取值为0;当编码设备确定该合并区域使用滤波系数B时,编码设备确定该合并区域的区域系数标识的取值为1;当编码设备确定该合并区域使用滤波系数A和滤波系数B时,编码设备确定该合并区域的区域系数标识的取值为2。
对于任一合并区域,当解码设备从码流中解析到的该合并区域的区域系数标识的取值为0时,确定该区域使用滤波系数A;当解码设备从码流中解析到的该合并区域的区域系数标识的取值为1时,确定该合并区域使用滤波系数B;解码设备从码流中解析到的该合并区域的区域系数标识的取值为2时,确定该合并区域使用滤波系数A和滤波系数B。
示例性的,对于任一合并区域,当解码设备基于从码流中解析得到的该合并区域的区域系数标识确定该区域使用一组滤波系数时,对于该合并区域的任一LCU,当确定对该LCU启动ALF滤波时,如该LCU的LCU系数标识的取值为非第一值时,可确定该LCU使用的滤波系数即为该合并区域使用的滤波系数;当解码设备基于从码流中解析得到的该合并区域的区域系数标识确定该合并区域使用多组滤波系数时,当确定对该LCU启动ALF滤波时,可基于该LCU的LCU系数标识,确定该LCU使用的滤波系数(该合并区域使用的多组滤波系数中的一组滤波系数)。
基于LCU所属区域类别、从码流中解析得到的滤波系数、以及从码流中解析得到LCU所属合并区域的区域系数标识,确定LCU的滤波系数,可包括:当基于LCU所属合并区域的区域系数标识确定LCU所属合并区域使用多套滤波系数时,基于LCU所属区域类别、从码流中解析得到的滤波系数、以及LCU的LCU系数标识,确定LCU的滤波系数。
对于任一LCU,当解码设备基于从码流中解析得到的该LCU的区域类别标识确定了该LCU所属区域类别时,还可基于该LCU所属区域类别确定该LCU所属合并区域,并基于从码流中解析得到的该区域类别所属合并区域的区域系数标识,确定该区域类别使用的滤波系数。
举例来说,假设按照固定区域划分方式将当前图像帧的亮度分量划分为16个区域后,通过对区域类的LCU进行分类,共得到32个区域类别,在对区域类别进行合并之后,可基于区域类别合并情况得到一个索引表,该索引表可为一个32元一维向量,该32元一维向量中各元素依次为各区域类别所属合并区域的索引。
假设该32元一维向量为{a1,a2,a3,…,a32},则a1为区域类别0所属合并区域的索引…a32为区域类别32所属合并区域的索引。假设a1~a5均为0,a6~a11均为1,则表明区域类别0~4合并为合并区域0,区域类别5~10合并为合并区域1。
编码设备可通过码流将上述索引表发送给解码设备,以使解码设备基于从码流中解析得到的该索引表,确定各区域类别所属的合并区域,从而,对于任一LCU,可基于该LCU的区域类别标识,确定该LCU所属区域类别,并根据该LCU所属区域类别确定该LCU所属合并区域。
当解码设备确定LCU所属合并区域使用多套滤波系数时,解码设备可基于从码流中解析得到的该LCU的LCU系数标识,确定该LCU使用的滤波系数。
对于任一合并区域,该合并区域使用的多套滤波系数的滤波器形状可完全相同或不完全相同。例如,假设合并区域1使用滤波系数A、滤波系数B和滤波系数C,则滤波系数A、滤波系数B和滤波系数C的滤波器形状可均相同,或均不同,或部分相同,如滤波系数A和滤波系数B的滤波器形状相同,但滤波系数A和滤波系数C的滤波器形状不同。
在一些实施例中,T620中,基于LCU所属区域类别以及从码流中解析得到的滤波系数,确定LCU的滤波系数,可包括:基于LCU所属区域类别、从码流中解析得到的滤波系数、以及LCU的系数选择标识,确定LCU的滤波系数;其中,系数选择标识用于标识LCU在多组候选滤波系数中选择使用的滤波系数。
为了优化ALF滤波效果,提升编解码性能,LCU不再限制于选择其所属合并区域的滤波系数,而是可从多组滤波系数中自适应的选择一组滤波系数进行ALF滤波。
示例性的,对于任一LCU,该LCU的候选滤波系数可包括但不限于其所属合并区域的滤波系数以及其所属合并区域的相邻合并区域的滤波系数,从而,在每个合并区域传递一组滤波系数的情况下,一个LCU可存在多组候选的滤波系数,提高LCU滤波系数选择的灵活性,优化ALF滤波效果,提升编解码性能。
对于任一LCU,编码设备可基于RDO决策确定该LCU在多组候选滤波系数中使用的滤波系数,并将该滤波系数对应的系数选择标识写入码流中发送给解码设备。解码设备可基于LCU所属区域类别、从码流中解析得到的滤波系数、以及LCU的系数选择标识,确定LCU的滤波系数。
在一个示例中,上述基于LCU所属区域类别、从码流中解析得到的滤波系数、以及LCU的系数选择标识,确定LCU的滤波系数,可包括:当LCU的系数选择标识的取值为第一值时,将LCU所属合并区域的前一个合并区域的滤波系数确定为LCU的滤波系数;当LCU的系数选择标识的取值为第二值时,将LCU所属合并区域的滤波系数确定为LCU的滤波系数;当LCU的系数选择标识的取值为第三值时,将LCU所属合 并区域的后一个合并区域的滤波系数确定为LCU的滤波系数。
对于任一LCU,其候选滤波系数可包括其所属合并区域的滤波系数、其所属合并区域的前一个合并区域的滤波系数、以及其所属合并区域的后一个合并区域的滤波系数。示例性的,LCU所属合并区域的前一个合并区域为LCU所属合并区域的索引的前一个相邻索引对应的合并区域。LCU所属合并区域的后一个合并区域为LCU所属合并区域的索引的后一个相邻索引对应的合并区域。
举例来说,假设LCU所属合并区域为合并区域2,其对应的索引为2,则该LCU所属合并区域的前一个合并区域为索引2的前一个相邻索引(即1)对应的合并区域(即合并区域1),该LCU所属合并区域的后一个合并区域为索引2的后一个相邻索引(即3)对应的合并区域(即合并区域3)。
对于任一LCU,编码设备可基于RDO决策确定其使用的滤波系数,当确定该LCU使用的滤波系数该LCU所属合并区域的前一个合并区域的滤波系数时,可确定该LCU的系数选择标识的取值为第一值,如0;当确定该LCU使用的滤波系数该LCU所属合并区域的滤波系数时,可确定该LCU的系数选择标识的取值为第二值,如1;当确定该LCU使用的滤波系数该LCU所属合并区域的后一个合并区域的滤波系数时,可确定该LCU的系数选择标识的取值为第三值,如2。
示例性的,对于任一LCU,当解码设备从码流中解析得到的该LCU的系数选择标识的取值为第一值时,可将该LCU所属合并区域的前一个合并区域的滤波系数确定为该LCU的滤波系数;当从码流中解析得到的该LCU的系数选择标识的取值为第二值时,可将该LCU所属合并区域的滤波系数确定为该LCU的滤波系数;当从码流中解析得到的该LCU的系数选择标识的取值为第三值时,可将该LCU所属合并区域的后一个合并区域的滤波系数确定为该LCU的滤波系数。
从码流中解析得到滤波系数,可包括:对于任一合并区域,从码流中解析该合并区域的滤波器形状;基于该滤波器形状,从码流中解析该合并区域的滤波系数。
示例性的,为了提高滤波系数的灵活性,优化ALF滤波效果,提升编解码性能,各合并区域不再限制于使用同一滤波器形状,而是可选择性地使用不同滤波器形状,即不同合并区域使用的滤波器形状可相同,也可不同。
示例性的,对于任一合并区域,编码设备可训练不同滤波器形状的多组滤波系数,并基于RDO决策确定该合并区域使用的滤波器形状和滤波系数,并将该滤波器形状和滤波系数写入码流发送给解码设备。
示例性的,对于任一合并区域,解码设备在获取该合并区域的滤波系数时,可从码流中解析该合并区域的滤波器形状,并基于该滤波器形状,从码流中解析该区域类别的滤波系数。
在一个示例中,上述基于LCU所属区域类别以及从码流中解析得到的滤波系数,确定LCU的滤波系数,可包括:基于LCU所属区域类别以及从码流中解析得到的滤波器形状以及滤波系数,确定LCU的滤波器形状和滤波系数;
上述基于LCU的滤波系数对LCU的像素逐个进行ALF滤波,可包括:基于该LCU的滤波器形状和滤波系数对LCU的像素逐个进行ALF滤波。示例性的,对于任一LCU,可基于该LCU所属区域类别,确定该LCU所属合并区域,从码流中解析该合并区域的滤波器形状以及滤波系数,将该滤波器形状以及滤波系数确定为该LCU的滤波器形状和滤波系数,并基于该滤波器形状和滤波系数对LCU的像素逐个进行ALF滤波。
在本申请实施例中,也可针对图像帧选择滤波器形状,或针对图像帧的分量(如亮度分量和/或色度分量)选择滤波器形状。例如,若图像帧A选择如图4A所示的7*7十字形加上5*5方形的中心对称滤波器形状,则图像帧A中的各启动ALF滤波的LCU均使用7*7十字形加上5*5方形的中心对称滤波器形状。
在一些实施例中,T630中,基于LCU的滤波系数对LCU的像素逐个进行ALF滤 波,可包括:基于LCU的滤波系数以及从码流中解析得到的LCU所属合并区域对应的各参考像素位置的权重系数,对LCU的像素逐个进行ALF滤波。
示例性的,为了优化ALF滤波效果,提升编解码性能,进行ALF滤波时使用的滤波器不再限制于对称滤波器,而是可采用非对称滤波器,即位置对称的滤波系数可不同,并满足一定的比例关系,如0.5:1.5或0.6:1.4等。
由于基于确定的滤波系数进行ALF滤波时,对于任一非中心位置的滤波系数,需要基于该滤波系数,与该滤波系数的对称位置的滤波系数,分别与对应位置的参考像素的乘积之和,得到滤波后的像素值,因此,上述比例可作为对称位置的滤波系数之间的比例,或者,也可作为对称位置的滤波系数对应的参考像素的像素值参与ALF滤波计算时的加权比重的比例(也可称为权重比例),即上述非对称滤波器是指对称位置的滤波系数不同,或者,对称位置的滤波系数对应的参考像素的像素值在参与ALF滤波计算时的权重不同。
举例来说,7*7十字形加上5*5方形的中心对称滤波器形状的滤波系数Ci,其对称位置的滤波系数为C28-i,则Ci:C28-i=Ai:(2-Ai),或者,Pi和P28-i在参与ALF滤波计算时的加权权重的比例为Ai:(2-Ai),Pi为Ci对应的参考像素位置的像素值,P28-i为C28-i对应的参考像素位置的像素值,对于LCU的当前滤波像素,该像素滤波后的像素值可通过以下方式确定:
Figure PCTCN2022078876-appb-000001
Ci为LCU所属合并区域的滤波系数中的第(i+1)个滤波系数,Pi为滤波系数Ci对应的参考像素位置的像素值,P28-i对应的参考像素位置与Pi对应的参考像素位置关于当前滤波像素的像素位置中心对称,Ai为Pi对应的参考像素位置的像素值的权重系数,P14为当前滤波像素的像素值,C14为当前滤波像素的滤波系数,0<Ai<2。
示例性的,对于任一合并区域,编码设备可确定每个位置对应不同的权重系数下,该合并区域的滤波系数以及滤波性能。选择滤波性能最好的一组滤波系数,记录该滤波系数以及对应滤波器每个位置上对应的权重系数,并将其写入码流发送给解码设备。
示例性的,可预先构建权重系数集合(如上述Ai的取值集合),并分别从该集合中选择各权重系数,以得到滤波性能最好的滤波系数以及对应滤波器每个位置上对应的权重系数,并将该权重系数在权重系数集合中的索引写入码流发送给解码设备。
对于任一LCU,解码设备可从码流中解析得到该LCU所属合并区域的滤波系数以及该LCU所属合并区域对应的各参考像素位置的权重系数,对LCU的像素逐个进行ALF滤波。
在一些实施例中,T630中,基于LCU的滤波系数对LCU的像素逐个进行ALF滤波,可包括:对于LCU的当前滤波像素,在对该像素进行ALF滤波的过程中,基于该像素的周围像素的像素值对该像素的像素值进行更新;基于该像素更新后的像素值,对该像素进行ALF滤波。
示例性的,考虑到对于任一像素位置,当该像素位置的像素值过大或过小时,按传统ALF技术进行对该像素位置进行滤波的滤波性能较差,因而,为了优化ALF滤波效果,对于当前滤波像素,在对该像素进行ALF滤波的过程中,可基于该像素的周围像素的像素值对该像素的像素值进行更新,以使该像素位置的像素值相对周围像素的像素值更加平滑。
在一个示例中,上述基于该像素的周围像素的像素值对该像素的像素值进行更新,可包括:确定目标像素块中除中心位置之外的各像素的像素值的最大值和最小值;其中,目标像素块为以该像素为中心位置的3*3像素块;当该像素的像素值大于最大值时,将该像素的像素值更新为最大值;当该像素的像素值小于最小值时,将该像素的像素值更新为最小值。
以像素的周围像素为该像素的8个相邻像素为例,即以该像素为中心位置的3*3像素块(本文中称为目标像素块)中除去中心位置之外的其余像素。
对于任一LCU中的任一像素,可确定目标像素块中除中心位置之外的各像素的像素值,并确定各像素值中的最大值和最小值。当该像素的像素值大于最大值时,将该像素的像素值更新为最大值;当该像素的像素值小于最小值时,将该像素的像素值更新为最小值。
以图12所示3*3像素块为例,假设当前滤波像素为像素0,其周围像素包括该像素的8个相邻像素,即像素1~像素8,在对像素0进行滤波时,可分别获取像素1~像素8的像素值,并确定该8个像素的像素值中的最大值和最小值。假设像素1的像素值最大,像素8的像素值最小,则该8个像素的像素值中的最大值即为像素1的像素值(假设为p1),最小值即为像素8的像素值(假设为p8),则可比较像素0的像素值(假设为p0)与p1和p8,若p0>p1,则将像素0的像素值更新为p1;若p0<p8,则将像素0的像素值更新为p8。
实施例二
请参见图6A,为本申请实施例提供的一种滤波方法的流程示意图,其中,该滤波方法可应用于编码/解码设备,如图6A所示,该滤波方法可包括以下步骤:
步骤S600a、在对当前自适应修正滤波单元内的当前滤波像素进行ALF滤波的过程中,对于当前滤波像素的任一参考像素,当该参考像素未处于当前自适应修正滤波单元内时,转至步骤S610a。
步骤S610a、确定是否能够获取到该参考像素的像素值;若是,则转至步骤S630a;否则,转至步骤S620a。
步骤S620a、使用当前自适应修正滤波单元以及边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波。
步骤S630a、使用该参考像素进行滤波。
滤波单元可为LCU,或基于LCU得到的图像块,例如,通过对LCU进行裁剪或扩展得到的图像块。
基于LCU得到滤波单元的实现,可参见上文中“自适应修正滤波单元”的相关说明。
本申请实施例中,考虑到对于滤波单元的边界像素,可能会存在该边界像素的部分参考像素在该滤波单元之外,即未处于该滤波单元内,此时,可能会无法获取到该部分参考像素的像素值。
在一个示例中,无法获取到参考像素的像素值可包括但不限于以下之一:该参考像素处于图像边界外、处于片边界外且不允许跨越片边界进行滤波、处于当前自适应修正滤波单元的上边界外或下边界外。
示例性的,考虑到对于任一像素位置,与该像素距离最近的其它像素位置,通常也是像素值最接近该像素位置的像素值的像素位置,因而,为了优化ALF滤波效果,对于无法获取到参考像素的像素值的情况,可使用当前自适应修正滤波单元以及边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波。
示例性的,像素位置之间的距离可为欧氏距离。
示例性的,边界区域包括当前自适应修正滤波单元的左边界外或右边界外,当前自适应修正滤波单元的左边界外包括当前自适应修正滤波单元左侧相邻的滤波单元中的部分或全部区域,当前自适应修正滤波单元的右边界外包括当前自适应修正滤波单元右侧相邻的滤波单元中的部分或全部区域。
以图5所示滤波单元(即图5中的样本滤波补偿单元)为当前自适应修正滤波单元为例,当前自适应修正滤波单元的边界区域可包括图5所示样本滤波补偿单元左边界左侧的3列像素(即当前自适应修正滤波单元左侧的滤波单元中靠近当前自适应修正滤波单元的3列像素,可称为左边界外);当前自适应修正滤波单元的边界区域可包括图 5所示样本滤波补偿单元右边界右侧的3列像素(即当前自适应修正滤波单元右侧的滤波单元中靠近当前自适应修正滤波单元的3列像素,可称为右边界外)。
在图6A所示方法流程中,在对当前自适应修正滤波单元中各像素进行ALF滤波的过程中,对于未处于当前自适应修正滤波单元内的参考像素位置,若无法获取到该参考像素位置的像素值,则使用当前自适应修正滤波单元以及边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波,优化了ALF滤波性能,提升了编解码性能。
在一些实施例中,在无法获取到该参考像素的像素值的情况下,上述使用当前自适应修正滤波单元以及边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波之前,还可包括:确定该参考像素是否对应滤波器形状的指定位置;若是,则确定执行上述使用当前自适应修正滤波单元以及边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波的操作。
考虑到对于某些特定位置的参考像素,当该参考像素的像素值无法获取时,通常边界区域内与该位置最接近的像素位置的像素值也无法获取。例如,当前滤波像素位置正左侧、正右侧、正上方或正下方的位置的参考像素。
举例来说,假设当前滤波像素位置(即C14对应的像素位置)处于当前自适应修正滤波单元的左边界,对于C11对应的参考像素位置,由于该参考像素位置处于当前滤波像素位置的左侧,且与当前滤波像素位置的距离为3像素,而一个滤波单元的宽通常是大于3像素的,因此,若C11对应的参考像素位置的像素值无法获取,则可确定当前自适应修正滤波单元的左侧的滤波单元处于当前图像帧(即当前自适应修正滤波单元所在图片帧)的边界外,或,处于当前片(即当前自适应修正滤波单元所在片(slice))的片边界外且不允许跨越片边界进行滤波,此时,边界区域内与该参考像素位置的距离最近的像素位置,即C12对应的像素位置的像素值也无法获取,此时,需要以当前自适应修正滤波单元内距离该参考像素位置(C11对应的参考像素位置)的像素值来代替该参考像素进行滤波。
以图14A所示场景为例,当C11对应的参考像素位置的像素值无法获取时,C12对应的参考像素位置也无法获取。
而对于当前滤波像素位置左上、右上、左下或右下位置的参考像素,当其像素值无法获取时,可能是由于其处于当前自适应修正滤波单元的上边界外或下边界外(当前自适应修正滤波单元的上边界外或下边界外的像素位置的像素值无法获取),而此时,与该参考像素位置距离最近的像素位置可能处于当前自适应修正滤波单元的左边界外或右边界外,其像素值可能可获取。
举例来说,假设当前滤波像素位置(即C14对应的像素位置)处于当前自适应修正滤波单元的左上方,对于C1对应的参考像素位置,由于该参考像素位置处于当前滤波像素位置的左上方,当当前滤波像素位置比较靠近当前自适应修正滤波单元的左上顶点时,C1对应的参考像素位置可能会处于当前自适应修正滤波单元的上边界外,从而,该参考像素位置的像素值无法获取,而在该情况下,C6对应的像素位置可能会处于当前自适应修正滤波单元的左边界外,其像素值可能是可获取的。
以图14B所示场景为例,由于C1对应的参考像素位置处于当前自适应修正滤波单元的上边界外,因此,C1对应的参考像素位置的像素值无法获取,而C6对应的参考像素位置处于当前自适应修正滤波单元的左边界外,当当前自适应修正滤波单元的左边界外的像素值可获取,如当前自适应修正滤波单元的左边界不是图像边界或片边界时,C6对应的参考像素位置的像素值可获取,因此,在该情况下,对于无法获取到像素值的参考像素位置,可使用当前自适应修正滤波单元内或边界区域内距离最近的像素位置的像素值来替代该参考像素进行滤波。
为了优化ALF滤波效果,对于处于滤波器状态的指定位置的参考像素,在无法获取到该参考像素的像素值的情况下,可使用当前自适应修正滤波单元以及边界区域内距 离该参考像素位置最近的像素代替该参考像素进行滤波。
示例性的,若该参考像素未对应滤波器形状的指定位置,则可使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行滤波,即不考虑边界区域内的像素。
在一个示例中,指定位置可包括但不限于第一滤波器中的第一位置、第二位置、第三位置、以及第一位置、第二位置和第三位置的对称位置;其中,第一滤波器为7*7十字形加5*5方形的中心对称滤波器,第一位置为第一滤波器的左上角位置,第二位置为第一位置的右侧相邻位置,第三位置为第一位置的下方相邻位置,对称位置包括轴对称位置和中心对称位置。
举例来说,对于图4A所示第一滤波器,第一位置为C1位置,其轴对称位置为C5位置,第二位置为C2位置,其轴对称位置为C4位置,第三位置为C6位置,其轴对称位置为C10位置,即上述指定位置可包括C1、C2、C6、C4、C5和C10。
在一些实施例中,在无法获取到该参考像素的像素值的情况下,上述使用当前自适应修正滤波单元以及边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波之前,还可包括:确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波;若是,则确定执行上述使用当前自适应修正滤波单元以及边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波的操作。
示例性的,考虑到允许使用增强自适应修正滤波(enhanced ALF)的情况下和不允许使用增强自适应修正滤波的情况下,使用的滤波器通常是不同的。
示例性的,允许使用增强自适应修正滤波的情况下使用的滤波器可如图4A所示,而不允许使用增强自适应修正滤波的情况下使用的滤波器可如图9所示。
而对于图9所示的滤波器,当参考像素的像素值无法获取时,通常当前自适应修正滤波单元之外的与该参考像素位置距离最近的像素位置的像素值也会无法获取,因此,对于不允许使用增强自适应修正滤波的情况,可不考虑使用边界区域内的像素替代该无法获取像素值的参考像素进行滤波,考虑使用当前自适应修正滤波单元内的像素替代该无法获取像素值的参考像素进行滤波。因而,对于任一参考像素,在无法获取到该参考像素的像素值的情况下,可确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波。示例性的,可基于EalfEnableFlag的值确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波,当EalfEnableFlag等于1时,表示可使用增强自适应修正滤波;当EalfEnableFlag等于0时,表示不应使用增强自适应修正滤波。
示例性的,EalfEnableFlag的值可从解码端导出、或在解码端由码流中获取,EalfEnableFlag的值也可是一个常值。示例性的,可基于从码流中解析得到的增强自适应修正滤波允许标志(ealf_enable_flag)的值确定EalfEnableFlag的值。
“增强自适应修正滤波允许标志”可为序列级参数,即一个“增强自适应修正滤波允许标志”的值可用于指示一个图像序列是否允许使用增强自适应修正滤波。示例性的,当解码设备确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取时,可使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行滤波。
示例性的,当解码设备确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取时,可使用边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波。
示例性的,当解码设备确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取时,可使用当前自适应修正滤波单元和边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波。
示例性的,当解码设备确定当前自适应修正滤波单元不允许使用增强自适应修正 滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取时,则可使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波,即不考虑边界区域内的参考像素。
如图6B所示,为本申请实施例提供的一种滤波方法的流程示意图,其中,滤波方法可应用于编码/解码设备,如图6B所示,该滤波方法可包括以下步骤:
步骤S600b、确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波。若是,则转至步骤S610b;否则,转至步骤S620b。
步骤S610b、使用第一滤波器对当前自适应修正滤波单元进行自适应修正滤波。
步骤S620b、使用第二滤波器对当前自适应修正滤波单元进行自适应修正滤波。
本申请实施例中,为了提高滤波器选择的灵活性,优化滤波性能,提升编解码性能,自适应修正滤波单元允许使用增强自适应修正滤波和不允许使用增强自适应修正滤波时,使用的滤波器可不同。示例性的,当解码设备确定当前自适应修正滤波单元允许使用增强自适应滤波时,对当前自适应修正滤波单元进行自适应修正滤波使用的滤波器可为第一滤波器。例如,该第一滤波器可为图4A所示的滤波器。
示例性的,当解码设备确定当前自适应修正滤波单元允许使用增强自适应滤波时,对当前自适应修正滤波单元进行自适应修正滤波使用的滤波器可为第二滤波器。例如,该第二滤波器可为图9所示的滤波器。
在一些实施例中,步骤S600b中,确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波,可包括:确定用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位取值,该标志位取值为第一取值时确定当前自适应修正滤波单元允许使用增强自适应修正滤波,该标志位取值为第二取值时确定当前自适应修正滤波单元不允许使用增强自适应修正滤波。
可通过标志位来指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波。示例性的,当该标志位的取值为第一取值(如0)时,表明当前自适应修正滤波单元允许使用增强自适应修正滤波。当该标志位的取值为第二取值(如1)时,表明当前自适应修正滤波单元允许使用增强自适应修正滤波。
示例性的,解码设备可获取该标志位取值,并基于该标志位取值确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波。
在对当前自适应修正滤波单元内的当前滤波像素进行自适应修正滤波的过程中,对于当前滤波像素的任一参考像素,当该参考像素未处于当前自适应修正滤波单元内时:在无法获取到该参考像素的像素值的情况下,使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;在获取到该参考像素的像素值的情况下,使用该参考像素的像素值进行自适应修正滤波。示例性的,考虑到对于滤波单元的边界像素,其参考像素中可能会存在部分参考像素在该滤波单元之外,即未处于该滤波单元内,此时,可能会无法获取到该部分参考像素的像素值。
在一个示例中,无法获取到参考像素的像素值可包括但不限于以下之一:该参考像素处于当前图像帧的图像边界外、处于当前片的片边界外且不允许跨越片边界进行滤波、处于当前自适应修正滤波单元的上边界外或下边界外。
示例性的,考虑到对于任一像素位置,与该像素距离最近的其它像素位置,通常也是像素值最接近该像素位置的像素值的像素位置,因而,为了优化滤波效果,对于无法获取到参考像素的像素值的情况,可使用当前自适应修正滤波单元以及边界区域内距离该参考像素位置最近的像素代替该参考像素进行滤波。
示例性的,像素位置之间的距离可为欧氏距离。
示例性的,边界区域包括当前自适应修正滤波单元的左边界外或右边界外,当前自适应修正滤波单元的左边界外包括当前自适应修正滤波单元左侧相邻的滤波单元中的部分或全部区域,当前自适应修正滤波单元的右边界外包括当前自适应修正滤波单元 右侧相邻的滤波单元中的部分或全部区域。
示例性的,若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波。
实施例三
本申请实施例提供了一种滤波方法,其中,该滤波方法可应用于解码设备,该滤波方法可包括以下步骤:
T700、当确定对当前图像帧的当前LCU启动ALF滤波时,获取当前LCU所属合并区域的区域系数标识。
T710、基于当前LCU所属合并区域的区域系数标识,获取当前LCU的滤波系数,区域系数标识用于标识在预设多组滤波系数中LCU所属合并区域使用的滤波系数。
本申请实施例中,为了优化ALF滤波效果,提高编解码性能,一个合并区域使用的滤波系数不再限制于一组滤波系数,而可根据实际情况选择使用一组或多组滤波系数。
示例性的,对于任一合并区域,编码设备可训练多组滤波系数,并基于RDO决策确定该合并区域使用该多组滤波系数中的一组或多组,并将用于标识该合并区域使用的滤波系数的区域系数标识写入码流。
示例性的,当解码设备确定对当前图像帧的当前LCU启动ALF滤波时,解码设备可基于从码流中解析得到的信息中获取当前LCU所属合并区域的区域系数标识,并基于该区域系数标识,确定当前LCU所属合并区域使用的滤波系数。
当确定了当前LCU所属合并区域使用的滤波系数时,可从该合并区域使用的滤波系数中,确定当前LCU的滤波系数。
示例性的,当当前LCU所属合并区域使用一组滤波系数时,可将该合并区域使用的滤波系数确定为当前LCU的滤波系数。
T720、基于当前LCU的滤波系数对当前LCU的像素逐个进行ALF滤波。
本申请实施例中,当确定了当前LCU的滤波系数时,可基于当前LCU的滤波系数对当前LCU的像素逐个进行ALF滤波。
在实施例三所述的方法流程中,通过为各区域训练多组滤波系数,并基于RDO决策确定各合并区域使用所训练的多组滤波系数中的一组或多组,并通过区域系数标识将决策结果通知给解码设备,从而,一个区域不再限制于使用一组滤波系数,而是可根据性能选择使用一组或多组滤波系数,优化了ALF滤波性能,提升了编解码性能。
在一些实施例中,T700中,确定对当前帧图像的当前LCU启动ALF滤波,可包括:从码流中解析当前LCU的LCU系数标识;其中,该LCU系数标识用于标识在当前LCU所属合并区域使用的至少一组滤波系数中,当前LCU使用的滤波系数;当LCU的LCU系数标识的取值为非第一值时,确定对当前LCU启动ALF滤波。
示例性的,编码设备可通过区域系数标识通知解码设备合并区域使用一组或多组滤波系数。对于该区域的任一LCU,编码设备可通过LCU系数标识来标识该合并区域使用的一组或多组滤波系数中,该LCU使用的滤波系数。
示例性的,对于任一LCU,解码设备可基于从码流中解析得到的该LCU的LCU系数标识,确定是否对该LCU启动ALF滤波以及对该LCU启动ALF滤波的滤波系数。
示例性的,对于任一LCU,当该LCU的LCU系数标识的取值为第一值时,表明不对该LCU启动ALF滤波。
对于任一LCU,当解码设备从码流中解析到的该LCU的LCU系数标识的取值为 非第一值时,可确定对该LCU启动ALF滤波。
举例来说,假设第一值为0,则对于任一LCU,当解码设备从码流中解析得到的该LCU的LCU系数标识的取值为0时,可确定不对该LCU启动ALF滤波;当解码设备从码流中解析得到的该LCU的LCU系数标识的取值不是0时,可确定对该LCU启动ALF滤波,解码设备可根据该LCU的LCU系数标识,确定该LCU使用的滤波系数。
当LCU的LCU系数标识的取值为非第一值时,若该LCU所属合并区域使用一组滤波系数,则该LCU的滤波系数即为该组滤波系数;若该LCU所属合并区域使用多组滤波系数,则还需根据该LCU的LCU系数标识的具体取值,确定该LCU的滤波系数。
在一个示例中,T710中,基于当前LCU所属合并区域的区域系数标识,获取当前LCU的滤波系数,可包括:当基于当前LCU所属合并区域的区域系数标识确定LCU所属合并区域使用多套滤波系数时,基于当前LCU的LCU系数标识,从LCU所属合并区域使用的多套滤波系数中确定当前LCU的滤波系数。
对于任一LCU,当解码设备确定该LCU所属合并区域使用多套滤波系数时,解码设备可基于从码流中解析得到的该LCU的LCU系数标识,确定该LCU使用的滤波系数。对于任一合并区域,该合并区域使用的多套滤波系数的滤波器形状可完全相同或不完全相同。
实施例四
本申请实施例提供了一种滤波方法,其中,该滤波方法可应用于解码设备,该滤波方法可包括以下步骤:
T800、当确定对当前帧图像的当前LCU启动ALF滤波时,获取所述当前LCU的系数选择标识。
T810、基于当前LCU所属合并区域以及当前LCU的系数选择标识,确定当前LCU的滤波系数;其中,该系数选择标识用于标识当前LCU在多组候选滤波系数中选择使用的滤波系数。
本申请实施例中,为了优化ALF滤波效果,提升编解码性能,LCU不再限制于选择其所属合并区域的滤波系数,而是可从多组滤波系数中自适应的选择一组滤波系数进行ALF滤波。
对于任一LCU,该LCU的候选滤波系数可包括但不限于其所属合并区域的滤波系数以及其所属合并区域的相邻区域的滤波系数,从而,在每个区域传递一组滤波系数的情况下,一个LCU可存在多组候选的滤波系数,提高LCU滤波系数选择的灵活性,优化ALF滤波效果,提升编解码性能。
对于任一LCU,编码设备可基于RDO决策确定该LCU在多组候选滤波系数中使用的滤波系数,并将该滤波系数对应的系数选择标识写入码流中发送给解码设备。解码设备可基于当前LCU所属合并区域以及从码流中解析得到的当前LCU的系数选择标识,确定当前LCU的滤波系数。
T820、基于当前LCU的滤波系数对当前LCU的像素逐个进行ALF滤波。
本申请实施例中,当解码设备确定了当前LCU的滤波系数时,可基于当前LCU的滤波系数对当前LCU的像素逐个进行ALF滤波。
在实施例所述的方法流程中,通过对各LCU设置多组候选滤波系数,并基于RDO决策确定各LCU使用的滤波系数,通过系数选择标识将决策结果通知给解码设备,从而可提高各LCU使用的滤波系数的灵活性,优化ALF滤波性能,提升编解码性能。
在一些实施例中,T810中,基于LCU所属合并区域以及LCU的系数选择标识,确定LCU的滤波系数,可包括:当当前LCU的系数选择标识的取值为第一值时,将当前LCU所属合并区域的前一个合并区域的滤波系数确定为前LCU的滤波系数;当当前LCU的系数选择标识的取值为第二值时,将当前LCU所属合并区域的滤波系数确定为当前LCU的滤波系数;当当前LCU的系数选择标识的取值为第三值时,将当前LCU 所属合并区域的后一个合并区域的滤波系数确定为当前LCU的滤波系数。
示例性的,对于任一合并区域内的任一LCU,该LCU的候选滤波系数可包括该合并区域的滤波系数,该合并区域的前一个合并区域的滤波系数以及该合并区域的后一个合并区域的滤波系数。
示例性的,LCU所属合并区域的前一个合并区域为LCU所属合并区域的索引的前一个相邻索引对应的合并区域。LCU所属合并区域的后一个合并区域为LCU所属合并区域的索引的后一个相邻索引对应的合并区域。
对于按照固定区域划分方式得到的16个区域进行区域合并后得到的合并区域(假设依次为合并区域0~合并区域15),合并区域15的后一个合并区域可为合并区域0,合并区域0的前一合并个区域可为区域15。
示例性的,对于任一LCU,编码设备可基于RDO决策确定其使用的滤波系数,当确定该LCU使用的滤波系数该LCU所属合并区域的前一个合并区域的滤波系数时,可确定该LCU的系数选择标识的取值为第一值,如0;当确定该LCU使用的滤波系数该LCU所属合并区域的滤波系数时,可确定该LCU的系数选择标识的取值为第二值,如1;当确定该LCU使用的滤波系数该LCU所属合并区域的后一个合并区域的滤波系数时,可确定该LCU的系数选择标识的取值为第三值,如3。
示例性的,对于任一LCU,当解码设备从码流中解析得到的该LCU的系数选择标识的取值为第一值时,可将该LCU所属合并区域的前一个合并区域的滤波系数确定为该LCU的滤波系数;当从码流中解析得到的该LCU的系数选择标识的取值为第二值时,可将该LCU所属合并区域的滤波系数确定为该LCU的滤波系数;当从码流中解析得到的该LCU的系数选择标识的取值为第三值时,可将该LCU所属合并区域的后一个合并区域的滤波系数确定为该LCU的滤波系数。
可见,通过将LCU所属合并区域以及该LCU所属合并区域的前一个合并区域和后一个合并区域的滤波系数均作为LCU的候选滤波系数,并基于RDO决策选择一组滤波系数作为该LCU的滤波系数,从而,可在一个合并区域训练一组滤波系数的情况下,合并区域内的LCU可存在多组候选滤波系数,在不需要针对一个合并区域训练多组滤波系数的情况下,提高了LCU的滤波系数的灵活性,从而优化了ALF滤波性能,提升了编解码性能。
实施例五
请参见图7,为本申请实施例提供的一种滤波方法的流程示意图,其中,该滤波方法可应用于解码设备,如图7所示,该滤波方法可包括以下步骤:
步骤S700、当确定对当前帧图像的当前LCU启动ALF滤波时,基于当前LCU所属合并区域,获取当前LCU所属合并区域的滤波器形状。
步骤S710、基于滤波器形状,获取当前LCU所属合并区域的滤波系数。
本申请实施例中,为了提高滤波系数的灵活性,优化ALF滤波效果,提升编解码性能,各区域不再限制于使用同一滤波器形状,而是可选择性地使用不同滤波器形状,即不同合并区域使用的滤波器形状可相同,也可不同。
示例性的,对于任一合并区域,编码设备可训练不同滤波器形状的多组滤波系数,并基于RDO决策确定该合并区域使用的滤波器形状和滤波系数,并将该滤波器形状和滤波系数写入码流发送给解码设备。
示例性的,对于任一合并区域,解码设备在获取该合并区域的滤波系数时,可从码流中解析该合并区域的滤波器形状,并基于该滤波器形状,从码流中解析该合并区域的滤波系数。
步骤S720、基于滤波器形状和滤波系数对当前LCU的像素逐个进行ALF滤波。
本申请实施例中,当解码设备确定了当前LCU的滤波系数时,可基于当前LCU的滤波系数对当前LCU的像素逐个进行ALF滤波。
可见,在图7所示方法流程中,通过为各区域训练多组不同滤波器形状的滤波系数,并基于RDO决策确定各合并区域使用的滤波器形状和滤波系数,将决策结果通过码流通知给解码设备,解码设备可从码流中解析得到各区域的滤波器形状和滤波系数,从而,可优化ALF滤波效果,提升编解码性能。
在本申请实施例中,也可针对图像帧选择滤波器形状,或针对图像帧的分量(如亮度分量和/或色度分量)选择滤波器形状。例如,当图像帧A选择7*7十字形加上5*5方形的中心对称滤波器形状,则图像帧A中的各启动ALF滤波的LCU均使用7*7十字形加上5*5方形的中心对称滤波器形状。
实施例六
请参见图8,为本申请实施例提供的一种滤波方法的流程示意图,其中,该滤波方法可应用于解码设备,如图8所示,该滤波方法可包括以下步骤:
步骤S800、当确定对当前帧图像的当前LCU启动ALF滤波时,基于当前LCU所属合并区域,获取当前LCU所属合并区域的滤波系数以及各参考像素位置的权重系数。
步骤S810、基于滤波系数以及各参考像素位置的权重系数,对当前LCU的像素逐个进行ALF滤波。
本申请实施例中,为了优化ALF滤波效果,提升编解码性能,进行ALF滤波时使用的滤波器不再限制于对称滤波器,而是可采用非对称滤波器,即位置对称的滤波系数可不同,并满足一定的比例关系,如0.5:1.5或0.6:1.4等。
由于基于确定的滤波系数进行ALF滤波时,对于任一非中心位置的滤波系数,需要基于该滤波系数,与该滤波系数的对称位置的滤波系数,分别与对应位置的参考像素的乘积之和,得到滤波后的像素值,因此,上述比例可作为对称位置的滤波系数之间的比例,或者,也可作为对称位置的滤波系数对应的参考像素的像素值参与ALF滤波计算时的加权权重的比例(也可称为权重比例),即上述非对称滤波器是指对称位置的滤波系数不同,或者,对称位置的滤波系数对应的参考像素的像素值的权重不同。
举例来说,7*7十字形加上5*5方形的中心对称滤波器形状的滤波系数Ci,其对称位置的滤波系数为C28-i,则Ci:C28-i=Ai:(2-Ai),或者,Pi和P28-i在参与ALF滤波计算时的加权权重的比例为Ai:(2-Ai),Pi为Ci对应的参考像素位置的像素值,P28-i为C28-i对应的参考像素位置的像素值,对于LCU的当前滤波像素,该像素滤波后的像素值可通过以下方式确定:
Figure PCTCN2022078876-appb-000002
Ci为LCU所属合并区域的滤波系数中的第(i+1)个滤波系数,Pi为滤波系数Ci对应的参考像素位置的像素值,P28-i对应的参考像素位置与Pi对应的参考像素位置关于当前滤波像素的像素位置中心对称,Ai为Pi对应的参考像素位置的像素值的权重系数,P14为当前滤波像素的像素值,C14为当前滤波像素的滤波系数,0<Ai<2。
本申请实施例中,对于任一合并区域,编码设备可确定每个位置对应不同的权重系数下,该合并区域的滤波系数以及滤波性能。选择滤波性能最好的一组滤波系数,记录该滤波系数以及对应滤波器每个位置上对应的权重系数,并将其写入码流发送给解码设备。
示例性的,可预先构建权重系数集合(如上述Ai的取值集合),并分别从该集合中选择各权重系数,以得到滤波性能最好的滤波系数以及对应滤波器每个位置上对应的权重系数,并将该权重系数在权重系数集合中的索引写入码流发送给解码设备。
对于任一LCU,解码设备可从码流中解析得到该LCU所属合并区域的滤波系数以及该LCU所属合并区域对应的各参考像素位置的权重系数,对LCU的像素逐个进行ALF滤波。
在图8所示方法流程中,各合并区域使用的滤波器不再限制于对称滤波器,对称 位置的参考像素的滤波系数不再限制于相同,而是可满足一定的比例关系,且由于对称位置的滤波系数之间满足该比例关系,需要的滤波系数的数量并不会增加,从而,提高滤波系数的灵活性,优化了ALF滤波性能,提升了编解码性能。
实施例七
本申请实施例提供了一种滤波方法,该滤波方法可应用于编码设备,该滤波方法可包括以下步骤:
T100、对当前图像帧的亮度分量进行区域划分。
对图像帧的亮度分量的区域划分,可参见上文中“区域划分”部分的相关说明。
T110、对于任一区域,对该区域内的各LCU进行分类,并基于各LCU的类别将该区域划分为多个区域类别。
本申请实施例中,为了优化ALF滤波效果,提高编解码性能,当按照固定区域划分方式对图像帧的亮度分量进行区域划分得到多个区域时,对于各区域,可基于区域内各像素的像素特性,将区域内的LCU划分为至少一个类别,即一个区域可通过LCU分类的方式被划分为至少一个子区域或区域类别。
T120、对各区域类别进行区域合并,并确定各合并后的区域的滤波系数。
T130、将各合并后的区域的滤波系数以及各LCU的区域类别标识写入码流。
本申请实施例中,当编码设备按照上述方式对各区域内的LCU进行了分类时,编码设备可对各区域类别进行区域合并,得到至少一个合并后的区域,并确定各合并后的区域的滤波系数。
对各区域类别进行区域合并的实现方式,与上文中“区域合并”部分的相关说明相类似,在此不做赘述。
示例性的,对于任一区域类别,编码设备可基于其所属合并后的区域为其分配一个系数索引,该系数索引该对应其中一个合并后的区域的滤波系数。
本申请实施例中,编码设备可将各合并后的区域的滤波系数、各区域类别的索引以及用于标识各LCU所属区域类别的区域类别标识写入码流,并发送给解码设备。
解码设备的处理流程可参见上述实施例中的相关说明,在此不做赘述。
实施例八
本申请实施例提供了一种滤波方法,该滤波方法可应用于编码设备,该滤波方法可包括以下步骤:
T200、对于当前图像帧的任一合并区域,基于RDO决策确定该合并区域使用的滤波系数。
T210、基于该区域使用的滤波系数确定该合并区域的区域系数标识;其中,该区域系数标识用于标识在预设多组滤波系数中,该合并区域使用的滤波系数。
T220、将各合并区域使用的滤波系数以及各合并区域的区域系数标识写入码流。
本申请实施例中,为了优化ALF滤波效果,提高编解码性能,一个合并区域使用的滤波系数不再限制于一组滤波系数,而可根据实际情况选择使用一组或多组滤波系数。
对于任一合并区域,编码设备可训练多组滤波系数,并基于RDO决策确定该合并区域使用该多组滤波系数中的一组或多组,并将用于标识该合并区域使用的滤波系数的区域系数标识写入码流。
解码设备的处理流程可参见上述实施例中的相关说明,在此不做赘述。
上述滤波方法还可包括:对于当前图像帧的任一合并区域,当该合并区域使用的滤波系数包括多套时,基于该合并区域内各LCU使用的滤波系数,确定各LCU的LCU系数标识;将各LCU的LCU系数标识写入码流。
示例性的,编码设备可通过区域系数标识通知解码设备合并区域使用一组或多组滤波系数。对于该合并区域的任一LCU,编码设备可通过LCU系数标识来标识该合并区域使用的一组或多组滤波系数中,该LCU使用的滤波系数。
对于任一合并区域,当编码设备确定该合并区域使用多组滤波系数时,对于该合并区域的任一LCU,编码设备可通过LCU系数标识将该多组滤波系数中该LCU使用的滤波系数通知给解码设备。
对于任一LCU,当不对该LCU启动ALF滤波,编码设备可写入码流的该LCU的LCU系数标识的取值为第一值。举例来说,假设第一值为0,则对于任一LCU,当编码设备确定不对该LCU启动ALF滤波时,写入码流的该LCU的LCU系数标识的取值为0。
实施例九
本申请实施例提供了一种滤波方法,该滤波方法可应用于编码设备,该滤波方法可包括以下步骤:
T300、对于当前图像帧的任一合并区域,基于RDO决策从多组滤波系数中确定该合并区域使用的滤波系数;
T310、基于该区域使用的滤波系数,确定该合并区域内各LCU的系数选择标识;其中,该系数选择标识用于标识各LCU在多组候选滤波系数中选择使用的滤波系数。
T320、将各合并区域使用的滤波系数以及各LCU的系数选择标识写入码流。
本申请实施例中,为了优化ALF滤波效果,提升编解码性能,LCU不再限制于选择其所属合并区域的滤波系数,而是可从多组滤波系数中自适应的选择一组滤波系数进行ALF滤波。
示例性的,对于任一LCU,该LCU的候选滤波系数可包括但不限于其所属合并区域的滤波系数以及其所属合并区域的相邻区域的滤波系数,从而,在每个区域传递一组滤波系数的情况下,一个LCU可存在多组候选的滤波系数,提高LCU滤波系数选择的灵活性,优化ALF滤波效果,提升编解码性能。
示例性的,对于任一LCU,编码设备可基于RDO决策确定该LCU在多组候选滤波系数中使用的滤波系数,并将该滤波系数对应的系数选择标识写入码流中发送给解码设备。
解码设备的处理流程可参见上述实施例中的相关说明,在此不做赘述。
对于任一合并区域内的任一LCU,该LCU的候选滤波系数可包括该合并区域的滤波系数、该合并区域的前一合并区域的滤波系数以及该区域的后一合并区域的滤波系数。
对于按照固定区域划分方式得到的16个区域在经过区域合并后包括16个合并区域(假设依次为合并区域0~合并区域15),合并区域15的后一个合并区域可为合并区域0,合并区域0的前一个合并区域可为合并区域15。
对于任一LCU,编码设备可基于RDO决策确定其使用的滤波系数,当确定该LCU使用的滤波系数该LCU所属合并区域的前一个合并区域的滤波系数时,可确定该LCU的系数选择标识的取值为第一值,如0;当确定该LCU使用的滤波系数该LCU所属合并区域的滤波系数时,可确定该LCU的系数选择标识的取值为第二值,如1;当确定该LCU使用的滤波系数该LCU所属合并区域的后一个合并区域的滤波系数时,可确定该LCU的系数选择标识的取值为第三值,如3。
实施例十
本申请实施例提供了一种滤波方法,该滤波方法可应用于编码设备,该滤波方法可包括以下步骤:
T400、对于当前图像帧的任一合并区域,基于RDO决策确定该合并区域使用的滤波器形状和滤波系数。
T410、将各区域合并使用的滤波器形状和滤波系数写入码流。
本申请实施例中,为了提高滤波系数的灵活性,优化ALF滤波效果,提升编解码性能,各合并区域不再限制于使用同一滤波器形状,而是可选择性地使用不同滤波器形状,即不同合并区域使用的滤波器形状可相同,也可不同。
示例性的,对于任一合并区域,编码设备可训练不同滤波器形状的多组滤波系数,并基于RDO决策确定该合并区域使用的滤波器形状和滤波系数,并将该滤波器形状和滤波系数写入码流发送给解码设备。
解码设备的处理流程可参见上述实施例中的相关说明,在此不做赘述。
在本申请实施例中,也可针对图像帧选择滤波器形状,或针对图像帧的分量(如亮度分量和/或色度分量)选择滤波器形状。例如,当图像帧A选择7*7十字形加上5*5方形的中心对称滤波器形状,则图像帧A中的各启动ALF滤波的LCU均使用7*7十字形加上5*5方形的中心对称滤波器形状。
实施例十一
本申请实施例提供了一种滤波方法,该滤波方法可应用于编码设备,该滤波方法可包括以下步骤:
T500、对于当前图像帧的任一合并区域,基于RDO决策确定该合并区域使用的滤波系数以及对应的各参考像素位置的权重系数;
T510、将各合并区域使用的滤波系数以及对应的各参考像素位置的权重系数写入码流。
本申请实施例中,为了优化ALF滤波效果,提升编解码性能,进行ALF滤波时使用的滤波器不再限制于对称滤波器,而是可采用非对称滤波器,即位置对称的滤波系数可不同,并满足一定的比例关系,如0.5:1.5或0.6:1.4等。
举例来说,以图13所示滤波器为例,在图13所示滤波器中,关于C14位置中心对称的滤波系数不再限制于相同,而是可满足一定的比例关系,例如,C1:C27=0.5:1.5,C6:C22=0.6:1.4等。
基于确定的滤波系数进行ALF滤波时,对于任一非中心位置的滤波系数,需要基于该滤波系数以及该滤波系数的对称位置的滤波系数分别与对应位置的参考像素的乘积之和,得到滤波后的像素值。因此,上述比例可作为对称位置的滤波系数之间的比例,或者,也可作为对称位置的滤波系数对应的参考像素的像素值参与ALF滤波计算时的加权权重的比例(也可称为权重比例),即上述非对称滤波器是指对称位置的滤波系数不同,或者,对称位置的滤波系数对应的参考像素的像素值的权重不同。
举例来说,如图13所示的7*7十字形加上5*5方形的中心对称滤波器形状的滤波系数Ci,其对称位置的滤波系数为C28-i,则Ci:C28-i=Ai:(2-Ai),或者,Pi和P28-i在参与ALF滤波计算时的加权权重的比例为Ai:(2-Ai),Pi为Ci对应的参考像素位置的像素值,P28-i为C28-i对应的参考像素位置的像素值,对于LCU的当前滤波像素,该像素滤波后的像素值可通过以下方式确定:
Figure PCTCN2022078876-appb-000003
Ci为LCU所属合并区域的滤波系数中的第(i+1)个滤波系数,Pi为滤波系数Ci对应的参考像素位置的像素值,P28-i对应的参考像素位置与Pi对应的参考像素位置关于当前滤波像素的像素位置中心对称,Ai为Pi对应的参考像素位置的像素值的权重系数,P14为当前滤波像素的像素值,C14为当前滤波像素的滤波系数,0<Ai<2。
如图13所示的滤波器,假设Ci:C28-i=Ai(2-Ai),则在对称位置(关于C14中心对称)的滤波系数不同的情况下,也只需要训练C0~C14这15个系数,其余系数可基于权重系数确定。例如,假设A1=0.5,则C1:C27=0.5:1.5;假设A0=0.6,则C0:C28=0.6:1.4。
本申请实施例中,对于任一合并区域,编码设备可确定每个位置对应不同的权重系数下,该合并区域的滤波系数以及滤波性能。选择滤波性能最好的一组滤波系数,记录该滤波系数以及对应滤波器每个位置上对应的权重系数,并将其写入码流发送给解码设备。
示例性的,可预先构建权重系数集合(如上述Ai的取值集合),并分别从该集合 中选择各权重系数,以得到滤波性能最好的滤波系数以及对应滤波器每个位置上对应的权重系数,并将该权重系数在权重系数集合中的索引写入码流发送给解码设备。
解码设备的处理流程可参见上述实施例中的相关说明,在此不做赘述。
为了使本领域技术人员更好地理解本申请实施例提供的技术方案,下面结合具体实例对本申请实施例提供的技术方案进行说明。
针对传统ALF技术的缺点,本申请实施例提出如下优化方案:
方案1、对于每一帧,以LCU为最小单位,将其自适应划分为多个的区域,其中每个区域可能包括不止一个LCU,因此,提出对每个LCU进行分类,将同一个区域的LCU分为N类,N为正整数。
方案2、每个区域中可传递多组滤波系数,每组滤波器形状可相同也可不同。
方案3、基于每个LCU自适应的选择一套滤波系数,同一个区域的LCU可选择相邻区域的滤波系数。
方案4、每个区域只能传递一组滤波系数,但每个区域的滤波器形状可不相同。
方案5、将对称滤波器修改为非对称滤波器,包括将对称位置的滤波系数相同优化为对称位置上滤波系数满足一定的比例关系,如0.5:1.5或0.6:1.4等。
方案6、对于滤波时边界的样本取值,进行优化。
下面先分别从编码端和解码端对本申请的主要改进点进行说明。
一、编码方法及编码设备
对于编码设备,可获取ALF开关序列头,判断当前序列是否需要启用ALF技术。若ALF开关序列头为关闭,则ALF技术关闭,ALF优化技术(即本申请实施例提供的ALF滤波方案对传统ALF技术做出的优化,可包括上述方案1~方案6中的任一或多个优化方案)也关闭,将ALF开关序列头传到解码设备。若ALF开关序列头为打开,则进入ALF技术编码,并可获取ALF技术优化序列头。
若ALF技术优化关闭,则使用原ALF技术进行滤波。将ALF开关序列头传到,优化技术序列头以及ALF技术所需参数传到解码设备。
若ALF技术优化打开,则可使用以下方案进行优化,并将ALF开关序列头传到,优化技术序列头以及优化的ALF技术所需参数传递到解码设备。
示例性的,优化技术序列头也可不存在,此时,若ALF开关序列头打开,则确定使用优化的ALF技术方案。
1.1、以LCU为最小单位进行自适应区域划分
对亮度分量进行固定区域划分,得到多个区域;对于属于同一个区域的LCU再次进行划分(即对同一区域内的各LCU进行分类),同一个区域最多再划分为N1类,N1为正整数。示例性的,若N1=2,则区域总个数最多为原来2倍;若N1=1,则为原固定区域划分方案。
编码设备可将每个区域内的LCU划分的结果进行标记,发送给解码设备(即将各LCU的区域类别标识发送给解码设备)。
1.2、每个区域中可传递多组滤波系数方案
对于任一合并区域,可最多传递n组滤波系数。并对该合并区域内的各LCU进行标识。0表示关闭,即不启动ALF滤波;i表示当前LCU使用该区域内的某一套滤波系数,i的取值范围是[1,n]。
示例性的,每一套滤波系数的获取方式如下:第一次训练滤波系数,默认所有LCU都启用ALF滤波,在决策后,对于关闭的LCU(即不启动ALF滤波的LCU),不参与第二次滤波系数的训练,同时有相同标记的LCU共同训练同一组滤波系数。
同理,第三次滤波系数的训练,基于第二次决策的结果进行。
最后,基于帧级或区域级决定该图像帧或该合并区域最多使用n组滤波系数,最后将每个合并区域对应滤波系数写入码流。
1.3、每个LCU自适应的选择一套滤波系数
针对亮度分量,对于任一LCU,在决策时可选择使用当前LCU所在区域的滤波系数或使用其他区域的滤波系数,每个LCU可选的滤波器个数最大值为N2(即N2组滤波系数,N2≥2),在N2组滤波系数下进行RDO决策,选择性能最好的一组滤波系数,将当前LCU的最优选择结果发送给解码设备(即将系数选择标识发送给解码设备)。示例性的,N2小于或等于合并后区域的个数。
1.4、每个区域选择不同形状的滤波器
每个区域传递一组滤波系数,因此,对于任一LCU,编码设备可通过一个标志位通知解码设备对该LCU启动ALF滤波或不启动(即关闭)ALF滤波。
在计算每个区域的滤波系数时,对于任一合并区域,可分别计算N3(N3≥2)种不同的滤波器形状下的滤波系数,并分别计算在N3种滤波器形状下的滤波性能,选择性能最好的一种滤波器形状。然后,将各区域的性能最好的滤波器形状和滤波系数通过码流通知给解码设备。
编码设备也可基于帧级选择不同形状的滤波器,或者基于Y、U和V分量来选择不同形状的滤波器。以基于帧级选择不同形状的滤波器为例,对于任一图像帧,可分别计算N4种不同的滤波器形状下各区域的滤波系数,并分别计算在N4(N4≥2)种滤波器形状下,该图像帧的滤波性能,选择性能最好的一种滤波器形状。然后,将该图像帧的性能最好的滤波器形状,以及各区域的滤波系数通过码流通知给解码设备。
1.5、将对称滤波器修改为非对称滤波器
对于有N5(N5≥2)个系数的对称滤波器,只需要训练
Figure PCTCN2022078876-appb-000004
个滤波系数。
Figure PCTCN2022078876-appb-000005
为向下取整运算,即当“*”不是整数时,“*”的非整数部分置0,如
Figure PCTCN2022078876-appb-000006
示例性的,将对称滤波器修改为非对称滤波器之后,对称位置上的滤波系数满足不同的比例关系,从而进行系数训练时,依然只需要训练
Figure PCTCN2022078876-appb-000007
个滤波系数。
以图4A所示滤波器形状为例,Ci与C28-i为对称位置。可通过RDO决策来选择每个对称位置上的滤波系数的比例关系,并将各位置的滤波系数以及对称位置的滤波系数的比例通过码流发送给解码设备。示例性的,当所有对称位置的滤波系数的比例为1:1时,则训练得到的滤波器仍为对称滤波器。
二、解码方法及解码设备
对于解码设备,可从码流中读取ALF开关序列头,判断当前序列是否需要启用ALF技术。若ALF开关序列头为关闭,则ALF技术关闭。若ALF开关序列头为打开,则可继续读取ALF技术优化序列头。
若ALF技术优化序列头为关闭,则获取原ALF技术所需滤波参数;若ALF技术优化序列头为打开,则读取优化的ALF技术所需滤波参数。
示例性的,ALF优化技术序列头也可不存在,此时,若ALF开关序列头为打开,则读取优化的ALF技术所需滤波参数。
2.1、以LCU为最小单位进行自适应区域划分
对亮度分量进行固定区域划分,得到多个区域;从码流中读取所有区域的滤波系数,同时从码流中读取所有启动ALF滤波的LCU的区域类别标识,根据固定区域划分结果,与LCU的区域类别标识确定LCU所属区域类别,根据LCU所属区域类别获取对应的滤波系数,并对LCU的像素逐个进行ALF滤波。
2.2、每个区域中可传递多组滤波系数方案
从码流中读取帧级或区域级系数标识,根据帧级或区域级系数标识从码流中获取每个合并区域中的多组滤波系数,并由帧级或区域级系数标识确定可选择的滤波器个数(即滤波系数组数)。
从码流中获取每个LCU的LCU系数标识,根据各LCU的LCU系数标识选择一组滤波系数。在对当前LCU进行滤波时,使用该组滤波系数对该LCU的像素逐个进行 ALF滤波。
2.3、每个LCU自适应的选择一套滤波系数
从码流中读取每个区域中的滤波系数以及每个LCU的ALF标志位(即对LCU启动ALF滤波或不启动ALF滤波),对于每个启动ALF滤波的LCU,从码流中读取该LCU的系数选择标识。
对于任一LCU,可选的滤波器的个数最大值为N2(即候选滤波系数最多为N2组)。
2.4、每个区域选择不同形状的滤波器
对于任一合并区域,可从码流中读取该合并区域的滤波器形状,并根据滤波器形状读取该合并区域的滤波系数。根据滤波器形状与滤波系数对该合并区域内各LCU的像素逐个进行ALF滤波
2.5、将对称滤波器修改为非对称滤波器
从码流读取每个合并区域的滤波系数,并读取对称位置的滤波系数的比例系数。
按照各位置上的滤波系数以及对称位置的滤波系数的比例系数,导出该合并区域各位置上的滤波系数,对该合并区域内各LCU的像素逐个进行ALF滤波。
下面对滤波边界的样本取值优化方案进行说明。
实施例十二、滤波边界的样本取值优化方案1
假设滤波器形状如图4A所示。若自适应修正滤波过程中用到的样本(即对自适应修正滤波单元内当前滤波像素进行滤波时的参考像素)为自适应修正滤波单元内的样本(即该参考像素处于自适应修改滤波单元内),则使用该样本进行滤波;若自适应修正滤波过程中用到的样本不属于自适应修正滤波单元内的样本(即该参考像素未处于自适应修改滤波单元内),则按照如下方式进行滤波:
12.1、若该样本在图像边界外,或在片边界外且不允许跨越片边界进行滤波,则:
12.1.1、若该样本对应滤波器形状C1、C2、C6、C4、C5或C10位置,则使用自适应修正滤波单元与边界区域内距离该样本最近的样本代替该样本进行滤波;
12.1.2、若该样本不是对应滤波器形状C1、C2、C6、C4、C5或C10位置,则使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;
12.2、若该样本在自适应修正滤波单元上边界外或下边界外,则:
12.2.1、若该样本对应滤波器形状C1、C2、C6、C4、C5或C10位置,则使用自适应修正滤波单元与边界区域内距离该样本最近的样本代替该样本进行滤波;
12.2.2、若该样本不是对应滤波器形状C1、C2、C6、C4、C5或C10位置,则使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;
12.3、若该样本不满足12.1中的条件,也不满足12.2中的条件,则使用该样本进行滤波。
实施例十三、滤波边界的样本取值优化方案2
假设滤波器形状如图4A所示。若自适应修正滤波过程中用到的样本(即对自适应修正滤波单元内当前滤波像素进行滤波时的参考像素)为自适应修正滤波单元内的样本(即该参考像素处于自适应修改滤波单元内),则使用该样本进行滤波;若自适应修正滤波过程中用到的样本不属于自适应修正滤波单元内的样本(即该参考像素未处于自适应修改滤波单元内),则按照如下方式进行滤波:
13.1、若该样本在图像边界外,或在片边界外且不允许跨越片边界进行滤波,则使用自适应修正滤波单元与边界区域内距离该样本最近的样本代替该样本进行滤波;
13.2、若该样本在自适应修正滤波单元上边界外或下边界外,则使用自适应修正滤波单元与边界区域内距离该样本最近的样本代替该样本进行滤波;
13.3、若该样本不满足13.1中的条件,也不满足13.2中的条件,则使用该样本进行滤波。
实施例十四、滤波边界的样本取值优化方案3
假设滤波器形状如图4A所示。若自适应修正滤波过程中用到的样本(即对自适应修正滤波单元内当前滤波像素进行滤波时的参考像素)为自适应修正滤波单元内的样本(即该参考像素处于自适应修改滤波单元内),则使用该样本进行滤波;若自适应修正滤波过程中用到的样本不属于自适应修正滤波单元内的样本(即该参考像素未处于自适应修改滤波单元内),则按照如下方式进行滤波:
14.1、若该样本在图像边界外,或在片边界外且不允许跨越片边界进行滤波,则:
14.1.1、若EalfEnableFlag(增强自适应修正滤波的使能标志位)等于1,则使用自适应修正滤波单元与边界区域内距离该样本最近的样本代替该样本进行滤波;
14.1.2、若EalfEnableFlag等于0,则使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;
14.2、若该样本在自适应修正滤波单元上边界外或下边界外,则:
14.2.1、若EalfEnableFlag等于1,则使用自适应修正滤波单元与边界区域内距离该样本最近的样本代替该样本进行滤波;
14.2.2、若EalfEnableFlag等于0,则使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;
14.3、若该样本不满足14.1中的条件,也不满足14.2中的条件,则使用该样本进行滤波。
EalfEnableFlag指一个flag,其取值可包括‘1’或‘0’,当EalfEnableFlag等于1时,表示可使用增强自适应修正滤波;当EalfEnableFlag等于0时,表示不应使用自适应修正滤波。示例性的,EalfEnableFlag的值可从解码端导出、或者在解码端由码流中获取,EalfEnableFlag的值也可是一个常值。EalfEnableFlag的值可等于ealf_enable_flag(即增强自适应修正滤波允许标志)的值;当EalfEnableFlag等于1时,表示可使用增强自适应修正滤波;当EalfEnableFlag等于0时,表示不应使用自适应修正滤波。
实施例十五、滤波边界的样本取值优化方案4
当样本所在位置处于图像边界外,或片边界外且CplfEnableFlag的值为0,或者处于当前自适应修正滤波单元上边界或下边界外时,该样本无法获取到真实值,则取当前自适应修正滤波单元区域内与该样本距离最近的样本代替该样本进行滤波。
当前自适应修正滤波单元可使用如图4A所示的第一滤波器进行滤波,当前自适应修正滤波单元也可使用如图9所示的第二滤波器进行滤波。
假设当前自适应修正滤波单元使用如图4A所示的第一滤波器进行滤波,滤波器形状如图4A所示。
当自适应修正滤波过程中用到的任意样本(当前自适应修正滤波单元内当前滤波像素进行滤波时的参考像素样本)为当前自适应修正滤波单元内的样本,则直接使用该样本进行滤波;当自适应修正滤波过程中用到的任意样本不属于当前自适应修正滤波单元内的样本,按照如下方式进行滤波:
15.1、如果该样本在图像边界外,或在片边界外且CplfEnableFlag的值为0,则使用当前自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;CplfEnableFlag用于指示是否允许跨越片边界取值;
15.2、如果该样本在当前自适应修正滤波单元上边界外或下边界外,则使用当前自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;
15.3、否则,直接使用该样本进行滤波。
示例性的,CplfEnableFlag指示是否允许跨越片边界取值,也可称作cross_patch_loopfilter_enable_flag。
如图4C所示,当前自适应修正滤波单元内进行自适应修正滤波的像素位置是14样本位置,需要获取当前自适应修正滤波单元外部的参考像素样本,如图4C所示,作为一种示例,参考像素样本0,1,2,3,4,5,6,7,8,9,10在当前自适应修正滤 波单元的上边界外,这些位置的样本值获取不到时,需要找到其他样本值来代替。
当滤波样本在当前自适应修正滤波单元的左上角时,例如,参考像素样本1,2,6和7位置的样本值无法获取,则使用当前自适应修正滤波单元内距离该样本1,2,6,7最近的样本位置的样本值进行滤波,14样本位置是当前自适应修正滤波单元中距离这四个点样本最近的位置,可将因此都取14样本位置的样本值代替分别作为这四个样本的取值进行滤波。
参考像素样本4,5,9,10位置的样本值无法获取,则使用当前自适应修正滤波单元内距离4,5,9,10最近的样本位置的样本值进行滤波,其中,15样本位置是当前自适应修正滤波单元中距离4,9样本最近的样本位置,可将15样本位置的样本值分别作为4,9样本的取值进行滤波;其中,16样本位置是当前自适应修正滤波单元中距离5,10样本最近的位置,可将16样本位置的样本值分别作为5,10样本的取值进行滤波。参考像素样本0,3,8位置的样本值无法获取,使用当前自适应修正滤波单元内距离该样本0,3,8最近的样本位置的样本值进行滤波,14样本位置是当前自适应修正滤波单元中距离这三个点样本最近的位置,因此,可将14样本位置的样本值代替分别作为这三个样本的取值进行滤波。
以上仅为部分参考像素样本不可获取时的取值获取方式的示例,不代表所有情况,也不是对本申请保护范围的限定。
下面对ALF滤波优化方案进行详细说明。
实施例十六、以LCU为最小单位进行自适应区域划分
编码设备
以图2所示的固定区域划分方式为例,对于图像帧的亮度分量,可按照上文中“区域划分”部分的描述的方式进行固定区域划分。将亮度分量划分为16个区域,每个区域标记为K,K∈[0,15],在每个区域内部存在1个或多个LCU。
对于属于同一区域的LCU进行再次划分。
示例性的,区域内LCU划分方法可使用LCU合并的方式,计算LCU两两合并的代价,将代价最小的两个LCU合并,依此类推,计算当合并只剩下[1,N6]类的所有代价,选择代价最小的一种划分方法。标记每个LCU最后的选择。
以最多可划分为两类为例,即上述N6=2,因此,每个LCU标记为1或0,即上述LCU的区域类别标识的取值包括1或0。
示例性的,对于标记为0(即区域类别标识的取值为0)的LCU,所属区域类别为2K;对于标记为1(即区域类别标识的取值为1)的LCU,所属类别为2K+1。
示例性的,亮度分量最多被划分为32个区域。区域划分后,对32个区域进行区域合并计算每个合并后的区域的滤波系数。将LCU区域划分结果(即各LCU的区域类别标识)以及在该区域划分后得到的滤波系数通过码流发送给解码设备。
解码设备
对于图像帧的亮度分量,可按照上文中“区域划分”部分的描述的方式进行固定区域划分。将亮度分量划分为16个区域,其划分结果示意图可如图2所示。
对于区域K的任一LCU,可获取该LCU的区域类别标识;区域类别标识的取值为0的LCU,所属区域类别为2K;区域类别为1的LCU,所属区域类别为2K+1。
基于各LCU的区域类别以及从码流中解析得到的滤波系数,确定各LCU的滤波系数,并基于各LCU的滤波系数对各LCU的像素逐个进行ALF滤波。
实施例十七、每个区域中可传递2组滤波系数的优化方案
编码设备
对每个LCU进行标识,假设0表示关闭ALF滤波,1表示使用第1组滤波系数,2表示使用第2组滤波系数,即LCU的LCU系数标识的取值包括0、1或2,上述第一值为0,非第一值包括1或2。
对每个区域进行系数标识,0表示只使用第一组滤波系数,1表示只使用第二组滤波系数,2表示使用两组滤波系数。
示例性的,第一组滤波系数的滤波器形状可如图4A所示,第二组滤波系数的滤波器器形状可如图12所示(7*7十字形加上3*3方形的中心对称滤波器形状)。
滤波系数训练过程中,第一次计算滤波系数时,滤波参数使用当前区域内所有的LCU的像素。经过决策后,训练第1组系数,仅使用标识的取值为1的LCU参与训练。训练第2组系数时,仅使用标识的取值为2的LCU参与训练。最后经过RDO决策确定当前区域仅使用某一组滤波器,或使用两组滤波器的性能。
若仅使用第一组滤波系数的性能最优,则确定区域系数标识的取值为0,写入码流,且将第一组滤波系数写入码流,并将各LCU的LCU系数标识写入码流,每个LCU的LCU系数标识的取值为0或1;若仅使用第二组滤波系数的性能最优,则确定区域系数标识的取值为1,写入码流,且将第二组滤波系数写入码流,并将各LCU的LCU系数标识写入码流,每个LCU的LCU系数标识的取值为0或1;若使用两组滤波系数的性能最优,则确定区域系数标识的取值为2,写入码流,且将两组滤波系数写入码流,并将LCU标识写入码流,每个LCU的LCU系数标识的取值为0、1或2。
解码设备
对于任一合并区域,从码流读取该合并区域的区域系数标识,若区域系数标识的取值为0,则该合并区域获取15个滤波系数(即第一组滤波系数);若区域系数标识的取值为1,则该合并区域获取9个滤波系数(即第二组滤波系数);若区域系数标识的取值为2,则该合并区域分别获取9个滤波系数和15个滤波系数。
示例性的,若区域系数标识的取值为0,则获取该合并区域内所有LCU的LCU系数标识;若LCU系数标识的取值为0,则表示该LCU关闭ALF滤波,即不对该LCU启动ALF滤波;若LCU系数标识的取值为1,则表示该LCU打开ALF滤波,即对该LCU启动ALF滤波,且该LCU使用第一组滤波系数。
若区域系数标识的取值为1,则获取该合并区域内所有LCU的LCU系数标识,若LCU系数标识的取值为0,则表示该LCU关闭ALF滤波,即不对该LCU启动ALF滤波;若LCU系数标识的取值为1,则表示该LCU打开ALF滤波,即对该LCU启动ALF滤波,且该LCU使用第二组滤波系数。
若区域系数标识的取值为2,则获取该合并区域内所有LCU的LCU系数标识,若LCU系数标识的取值为0,则表示该LCU关闭ALF滤波,即不对该LCU启动ALF滤波;若LCU系数标识的取值为1,则表示该LCU打开ALF滤波,即对该LCU启动ALF滤波,且该LCU使用第一组滤波系数;若LCU系数标识的取值为2,则表示该LCU打开ALF滤波,即对该LCU启动ALF滤波,且该LCU使用第二组滤波系数。
实施例十八、每个LCU自适应的选择一套滤波系数
编码设备
以各LCU最多可选择3组滤波系数为例。对于任一LCU,该LCU的候选滤波系数包括该LCU所属合并区域的滤波系数(可称为当前合并区域的滤波系数)、该LCU所属合并区域的前一个合并区域的滤波系数(可称为前一个合并区域的滤波系数)、以及该LCU所属区域的后一个合并区域的滤波系数(可称为后一个合并区域的滤波系数)。
对于任一LCU,可分别计算在3组滤波系数下的性能(RDO决策),选择性能最优的一组滤波系数。
示例性的,若性能最优的组滤波系数是前一个合并区域的滤波器,则LCU的系数选择标识的取值为0(即以上述第一值为0为例);若性能最优的滤波系数是当前合并区域的滤波系数,则LCU的系数选择标识的取值为1(即以上述第二值为1为例);若性能最优的滤波系数是后一个合并区域的滤波系数,则LCU的系数选择标识的取值为2(即以上述第三值为2为例)。
举例来说,假设当前图像帧合并区域如图10所示,即合并区域的数量为16个;在进行决策时,若当前处理的LCU属于合并区域2,则该LCU的候选滤波系数可包括合并区域1的滤波系数、合并区域2的滤波系数以及合并区域3的滤波系数,可基于RDO决策确定性能最优的滤波系数,并基于决策结果对LCU进行标记。
由于色度分量(U分量或V分量)只有一组滤波系数,其LCU可不参与滤波系数的选择,或,两个色度分量的LCU可选择另一个分量上的滤波系数,即U分量的LCU可选择V分量的滤波系数,V分量的LCU可选择U分量的滤波系数。
解码设备
获取当前LCU所属合并区域的滤波系数(即当前区域的滤波系数)以及与其相邻的两个区域的滤波系数(即前一个合并区域的滤波系数和后一个合并区域的滤波系数),根据LCU的系数选择标识,选择当前LCU的滤波系数。
由于两个色度分量上分别只有一组滤波系数,其LCU可不参与滤波系数的选择,或,当两个色度分量都打开ALF滤波开关时,两个色度上的LCU可选择另一个分量上的滤波系数,即U分量的LCU可选择V分量的滤波系数,V分量的LCU可选择U分量的滤波系数。
实施例十九、每个区域选择不同形状的滤波器
编码设备
示例性的,滤波器形状可选择如图4A或图9的滤波器形状,也可选择如图11A至图11D所示的4种滤波器形状中的两种或多种形状,也可选择除图4A、图9以及图11A至图11D所示滤波器形状以外的其他滤波器形状。
对于任一合并区域,可训练N3组滤波系数,该N3组滤波系数的滤波器形状不同,在每个区域中计算该合并区域使用其中某一种滤波器形状后的性能,选择性能最优的一组滤波系数,将对应的滤波器形状通过码流发送给解码设备,并将该合并区域性能最优的滤波系数发送给解码设备。
解码设备
对于任一LCU,当确定对该LCU启动ALF滤波时,基于该LCU所属合并区域,获取该合并区域的滤波器形状,并基于该滤波器形状获取该合并区域的滤波系数。
当确定了当前LCU的滤波系数时,可基于当前LCU的滤波系数对当前LCU的像素逐个进行ALF滤波。
实施例二十、将对称滤波器修改为非对称滤波器
编码设备
以图4A所示滤波器形状为例,可确定Ci(i=0,1,…,13)位置的参考像素的像素值的权重系数Ai,此时其对称位置C28-i对应的参考像素值权重为2-Ai。
示例性的,Ai∈[0.5,0.6,0.8,1.2,1.4,1.5,1]。
如图4A所示,一共存在14个对称位置,可计算每个位置对应不同权重系数下,该区域的滤波系数以及滤波性能。选择滤波性能最优的一组滤波系数,记录该滤波系数以及对应滤波器每个位置上对应的权重系数。
示例性的,对于任一权重系数,可将用于标识该权重系数在权重系数集合中的位置的标号(或称为索引)传递给解码设备。
解码设备获取每个区域的滤波系数以及每个滤波系数对应的权重系数。
对于任一合并区域,获取其滤波系数以及每个滤波系数对应的权重系数,以导出对应位置的滤波系数。
对于LCU的当前滤波像素,该像素滤波后的像素值可通过以下方式确定:
Figure PCTCN2022078876-appb-000008
Ci为LCU所属合并区域的滤波系数中的第(i+1)个滤波系数,Pi为滤波系数Ci 对应的参考像素位置的像素值,P28-i对应的参考像素位置与Pi对应的参考像素位置关于当前滤波像素的像素位置中心对称,Ai为Pi对应的参考像素位置的像素值的权重系数,P14为当前滤波像素的像素值,C14为当前滤波像素的滤波系数,0<Ai<2。
实施例二十一、每个LCU自适应的选择一套滤波系数
在对像素进行滤波的过程中,对于任一待滤波像素,在3*3像素块内(以当前待滤波像素为中心点的3*3像素块,且不包括当前待滤波像素在内)取出像素值的最大值与最小值,即以当前待滤波像素为中心的3*3像素块中除中心位置之外的8个像素的像素值中的最大值与最小值。
若当前待滤波像素的像素值大于最大值,或小于最小值,则由最大值或最小值代替当前待滤波像素的像素值参与滤波,即若当前待滤波像素的像素值大于最大值,则将当前待滤波像素的像素值替换为该最大值参与滤波;若当前待滤波像素的像素值小于最小值,则将当前待滤波像素的像素值替换为该最小值参与滤波。
下面对自适应修正滤波解码流程进行详细说明
实施例二十二、自适应修正滤波解码流程
一、自适应修正滤波参数定义:
参数1、自适应修正滤波允许标志(alf_enable_flag):二值变量。值为‘1’表示可使用自适应修正滤波;值为‘0’表示不应使用自适应修正滤波。
示例性的,AlfEnableFlag的值等于alf_enable_flag的值。alf_enable_flag的值可从序列头获取,即在整个序列开始压缩前,值为‘1’表示整个视频序列的ALF技术打开,值为‘0’表示整个视频序列的ALF技术关闭,序列头标志。
参数2、增强自适应修正滤波允许标志(ealf_enable_flag):二值变量。值为‘1’表示可使用增强自适应修正滤波;值为‘0’表示不应使用增强自适应修正滤波。
示例性的,EalfEnableFlag的值等于ealf_enable_flag的值,其语法描述如下:
if(AlfEnableFlag){  
ealf_enable_flag u(1)
}  
当AlfEnableFlag的值为1时,从码流中读取增强自适应修正滤波允许标志,该标志为序列头标志。
参数3、图像级自适应修正滤波允许标志(picture_alf_enable_flag[compIdx]):二值变量。值为‘1’表示当前图像的第compIdx个分量可使用自适应修正滤波;值为‘0’则表示当前图像的第compIdx个分量不应使用自适应修正滤波。
示例性的,PictureAlfEnableFlag[compIdx]的值等于picture_alf_enable_flag[compIdx]的值,其语法描述如下:
if(AlfEnableFlag){  
for(compIdx=0;compIdx<3;compIdx++){  
picture_alf_enable_flag[compIdx] u(1)
}  
当AlfEnableFlag的值为1时,从码流中读取Y、U、V三个分量的图像级自适应修正滤波允许标志,该标志为图像头标志。
参数4、图像亮度分量样本自适应修正滤波系数(alf_coeff_luma[i][j]):alf_coeff_luma[i][j]表示亮度分量第i个自适应修正滤波器的第j个系数。
示例性的,AlfCoeffLuma[i][j]的值等于alf_coeff_luma[i][j]的值。
示例性的,若EalfEnableFlag的值为0,则AlfCoeffLuma[i][j](j=0~7)的取值范围应为-64~63,AlfCoeffLuma[i][8]的取值范围应为-1088~1071。
若EalfEnableFlag的值为1,则AlfCoeffLuma[i][j](j=0~13)的取值范围应为-64~63, AlfCoeffLuma[i][14]的取值范围应为-1088~1071。
参数x:每组图像亮度分量样本自适应修正滤波系数的精度。若x=0,则AlfCoeffLuma[i][j](j=0~13)的取值范围应为-32~32,若x=1,则AlfCoeffLuma[i][j](j=0~13)的取值范围应为-64~63,若x=2,则AlfCoeffLuma[i][j](j=0~13)的取值范围应为-128~128。
参数5、图像色度分量自适应修正滤波系数(alf_coeff_chroma[0][j],alf_coeff_chroma[1][j]):alf_coeff_chroma[0][j]表示Cb分量第j个自适应修正滤波系数,alf_coeff_chroma[1][j]表示Cr分量第j个自适应修正滤波系数。
示例性的,AlfCoeffChroma[0][j]的值等于alf_coeff_chroma[0][j]的值,AlfCoeffChroma[1][j]的值等于alf_coeff_chroma[1][j]的值。
示例性的,若EalfEnableFlag的值为0,AlfCoeffChroma[i][j](i=0~1,j=0~7)的取值范围应为-64~63,AlfCoeffChroma[i][8](i=0~1)的取值范围应为-1088~1071。
若EalfEnableFlag的值为1,AlfCoeffChroma[i][j](i=0~1,j=0~13)的取值范围应为-64~63,AlfCoeffChroma[i][14](i=0~1)的取值范围应为-1088~1071。
参数y:每组图像色度分量自适应修正滤波系数的精度。若y=0,则AlfCoeffLuma[i][j](j=0~13)的取值范围应为-32~32,若y=1,则AlfCoeffLuma[i][j](j=0~13)的取值范围应为-64~63,若y=2,则AlfCoeffLuma[i][j](j=0~13)的取值范围应为-128~128。
参数6、图像亮度分量相邻自适应修正滤波区域个数(alf_region_distance[i]):alf_region_distance[i]表示亮度分量第i个自适应修正滤波区域基本单元起始标号与第i-1个自适应修正滤波区域基本单元起始标号间的差值。
示例性的,alf_region_distance[i]的取值范围应为1~FilterNum-1。
示例性的,当位流中不存在alf_region_distance[i]时,若i等于0,则alf_region_distance[i]的值为0;若i不等于0且alf_filter_num_minus1的值为FilterNum-1,则alf_region_distance[i]的值为1。
示例性的,alf_region_distance[i](i=0~alf_filter_num_minus1)之和应小于或等于FilterNum-1。
参数7、最大编码单元的自适应修正滤波允许标志(alf_lcu_enable_flag[compIdx][LcuIndex]):二值变量。值为‘1’表示第LcuIndex个最大编码单元compIdx分量的样本应使用自适应修正滤波;值为‘0’表示第LcuIndex个最大编码单元compIdx分量的样本不应使用自适应修正滤波。
示例性的,AlfLCUEnableFlag[compIdx][LcuIndex]的值等于alf_lcu_enable_flag[compIdx][LcuIndex]的值,其语法描述如下:
Figure PCTCN2022078876-appb-000009
若三个分量上的图像级自适应修正滤波允许标志中有一个标志值为1,则获取如下自适应修正滤波参数,即若EalfEnableFlag=1,则滤波系数的个数为15,且亮度分量上划分为64个区域;否则滤波系数的个数为9,且亮度分量上划分为16个区域。再分别获取三个分量上的滤波系数,若图像级自适应修正滤波允许标志打开,则在色度上,需要获取该分量上的滤波系数alf_coeff_chroma;在亮度上,需要获取区域合并方式标志alf_region_order_idx、滤波系数个数减1(alf_filter_num_minus1)、区域合并结果alf_region_distance[i]、以及每个滤波系数alf_coeff_luma。
上述自适应修正滤波参数的语法描述可如下:
自适应修正滤波参数定义 描述符
alf_parameter_set(){  
if(EalfEnableFlag){  
coeffNum=15  
FilterNum=64  
}  
else{  
FilterNum=16  
coeffNum=9  
}  
if(PictureAlfEnableFlag[0]==1){  
alf_filter_num_minus1 ue(v)
if(EalfEnableFlag){  
alf_region_order_idx u(2)
}  
for(i=0;i<alf_filter_num_minus1+1;i++){  
if((i>0)&&(alf_filter_num_minus1!=FilterNum))  
alf_region_distance[i] ue(v)
for(j=0;j<coeffNum;j++)  
alf_coeff_luma[i][j] se(v)
}  
}  
if(PictureAlfEnableFlag[1]==1){  
for(j=0;j<coeffNum;j++)  
alf_coeff_chroma[0][j] se(v)
}  
if(PictureAlfEnableFlag[2]==1){  
for(j=0;j<coeffNum;j++)  
alf_coeff_chroma[1][j] se(v)
}  
}  
二、自适应修正滤波解码具体过程
若PictureAlfEnableFlag[compIdx]的值为0,则将偏移后样本分量的值直接作为对应重建样本分量的值;否则,对相应的偏移后样本分量进行自适应修正滤波。示例性的,compIdx等于0表示亮度分量,等于1表示Cb分量,等于2表示Cr分量。
自适应修正滤波的单位是由最大编码单元导出的自适应修正滤波单元,按照光栅扫描顺序依次处理。首先根据自适应修正滤波系数解码过程得到各分量的自适应修正滤波系数,然后根据导出自适应修正滤波单元,根据确定当前自适应修正滤波单元亮度分量的自适应修正滤波系数索引,最后根据自适应修正滤波单元的亮度和色度分量进行自适应修正滤波,得到重建样本。
自适应修正滤波系数解码过程:
22.1.1、若EalfEnableFlag等于0,则从位流中解析得到亮度样本的第i组滤波系数AlfCoeffLuma[i][j](i=0~alf_filter_num_minus1,j=0~7)。对系数AlfCoeffLuma[i][8](即图9所示滤波器中的C8)做如下处理:
Figure PCTCN2022078876-appb-000010
式中AlfCoeffLuma[i][j](j=0~7)的位宽是7位,取值范围是-64~63;经上述处理后AlfCoeffLuma[i][8]的取值范围是0~127。
若EalfEnableFlag等于1,则从位流中解析得到亮度样本的第i组滤波系数AlfCoeffLuma[i][j](i=0~alf_filter_num_minus1,j=0~13)。对系数AlfCoeffLuma[i][14](即图4A所示滤波器中的C14)做以下处理:
Figure PCTCN2022078876-appb-000011
式中AlfCoeffLuma[i][j](j=0~13)的位宽是7位,取值范围是-64~63;经上述处理后AlfCoeffLuma[i][14]的取值范围是0~127。
22.1.2、根据alf_region_distance[i](i>1)得到亮度分量自适应修正滤波系数索引数组(记作alfCoeffIdxTab[FilterNum]):
count=0
alfCoeffIdxTab[0]=0
for(i=1;i<alf_filter_num_minus1+1;i++){
for(j=0;j<alf_region_distance[i]-1;j++){
alfCoeffIdxTab[count+1]=alfCoeffIdxTab[count]
count=count+1
}
alfCoeffIdxTab[count+1]=alfCoeffIdxTab[count]+1
count=count+1
}
for(i=count;i<FilterNum;i++){
alfCoeffIdxTab[i]=alfCoeffIdxTab[count]
22.1.3、若EalfEnableFlag等于0,则从位流中解析得到色度样本的滤波系数AlfCoeffChroma[0][j]和AlfCoeffChroma[1][j](j=0~7)。对系数AlfCoeffChroma[0][8]和AlfCoeffChroma[1][8](即图9所示滤波器中的C8)分别做以下处理:
Figure PCTCN2022078876-appb-000012
式中AlfCoeffChroma[i][j](j=0~7)的位宽是7位,取值范围是-64~63;经上述处理后AlfCoeffChroma[i][8]的取值范围是0~127。
若EalfEnableFlag等于1,从位流中解析得到色度样本的滤波系数AlfCoeffChroma[0][j]和AlfCoeffChroma[1][j](j=0~13)。对系数AlfCoeffChroma[0][14]和AlfCoeffChroma[1][14](即图4A所示滤波器中的C14)分别做以下处理:
Figure PCTCN2022078876-appb-000013
式中AlfCoeffChroma[i][j](j=0~13)的位宽是7位,取值范围是-64~63;经上述处理后AlfCoeffChroma[i][14]的取值范围是0~127。
导出自适应修正滤波单元
根据当前最大编码单元按下列步骤导出自适应修正滤波单元(可如图5所示):
22.2.1、将当前最大编码单元C所在样本区域超出图像边界的部分删除,得到样本 区域D;
22.2.2、若样本区域D的下边界所在的样本不属于图像的下边界,则将亮度分量和色度分量样本区域D的下边界向上收缩四行,得到样本区域E1;否则,令样本区域E1等于样本区域D。样本区域D的最后一行样本为区域的下边界;
22.2.3、若样本区域E1的上边界所在的样本属于图像的上边界,或者属于片边界且cross_patch_loopfilter_enable_flag的值为‘0’,令样本区域E2等于样本区域E1;否则,将亮度分量和色度分量样本区域E1的上边界向上扩展四行,得到样本区域E2。样本区域E1的第一行样本为区域的上边界;
22.2.4、将样本区域E2作为当前自适应修正滤波单元。图像的第一行样本为图像的上边界,最后一行样本为图像的下边界。
确定亮度分量自适应修正滤波单元的自适应修正滤波系数索引
若EalfEnableFlag的值等于0,则根据以下方法计算当前亮度分量自适应修正滤波单元的自适应修正滤波系数索引(记作filterIdx):
xInterval=((((horizontal_size+(1<<LcuSizeInBit)-1)>>LcuSizeInBit)+1)>>2)<<LcuSizeInBit
yInterval=((((vertical_size+(1<<LcuSizeInBit)-1)>>LcuSizeInBit)+1)>>2)<<LcuSizeInBit
if(xInterval==0&&yInterval==0){
index=15
}
else if(xInterval==0){
index=Min(3,y/yInterval)*4+3
}
else if(yInterval==0){
index=Min(3,x/xInterval)+12
}
else{
index=Min(3,y/yInterval)*4+Min(3,x/xInterval)
}
filterIdx=alfCoeffIdxTab[regionTable[index]]
其中,(x,y)是导出当前自适应修正滤波单元的最大编码单元左上角样本在图像中的坐标,regionTable定义如下:
regionTable[16]={0,1,4,5,15,2,3,6,14,11,10,7,13,12,9,8}
若EalfEnableFlag等于1,则根据以下方法计算当前亮度分量自适应修正滤波单元的自适应修正滤波系数索引(记作filterIdx)。
lcu_width=1<<LcuSizeInBit
lcu_height=1<<LcuSizeInBit
y_interval=((((vertical_size+lcu_height-1)/lcu_height)+4)/8*lcu_height)
x_interval=((((horizontal_size+lcu_width-1)/lcu_width)+4)/8*lcu_width)
if(yInterval==0){
y_st_offset=0
}
else{
y_cnt=Clip3(0,8,(vertical_size+y_interval-1)/y_interval)
y_st_offset=vertical_size-y_interval*(y_cnt-1)
y_st_offset=(y_st_offset+lcu_height/2)/lcu_height*lcu_height
}
if(xInterval==0){
x_st_offset=0
}
else{
x_cnt=Clip3(0,8,(horizontal_size+x_interval-1)/x_interval)
x_st_offset=horizontal_size-x_interval*(x_cnt-1)
x_st_offset=(x_st_offset+lcu_width/2)/lcu_width*lcu_width
}
y_index=(y_interval==0)?7:Clip3(0,7,y/y_interval)
y_index_offset=y_index<<3
y_index2=(y_interval==0||y<y_st_offset)?0:Clip3(-1,6,(y-y_st_offset)/y_interval)+1
y_index_offset2=y_index2<<3
x_index=(x_interval==0)?7:Clip3(0,7,x/x_interval)
x_index2=(x_interval==0||x<x_st_offset)?0:Clip_post(-1,6,(x-x_st_offset)/x_interval)+1
if(AlfRegionOrderIndex==0){
filterIdx=alfCoeffIdxTab[regionTable[0][y_index_offset+x_index]]
}
else if(AlfRegionOrderIndex==1)
filterIdx=alfCoeffIdxTab[regionTable[1][y_index_offset+x_index2]]
}
else if(AlfRegionOrderIndex==2)
filterIdx=alfCoeffIdxTab[regionTable[2][y_index_offset2+x_index2]]
}
else if(AlfRegionOrderIndex==3)
filterIdx=alfCoeffIdxTab[regionTable[3][y_index_offset2+x_index]]
}
其中,(x,y)是导出当前自适应修正滤波单元的最大编码单元左上角样本在图像中的坐标,regionTable定义如下:
regionTable[4][64]={{63,60,59,58,5,4,3,0,62,61,56,57,6,7,2,1,49,50,55,54,9,8,13,14,48,51,52,53,10,11,12,15,47,46,33,32,31,30,17,16,44,45,34,35,28,29,18,19,43,40,39,36,27,24,23,20,42,41,38,37,26,25,22,21},{42,43,44,47,48,49,62,63,41,40,45,46,51,50,61,60,38,39,34,33,52,55,56,59,37,36,35,32,53,54,57,58,26,27,28,31,10,9,6,5,25,24,29,30,11,8,7,4,22,23,18,17,12,13,2,3,21,20,19,16,15,14,1,0},{21,22,25,26,37,38,41,42,20,23,24,27,36,39,40,43,19,18,29,28,35,34,45,44,16,17,30,31,32,33,46,47,15,12,11,10,53,52,51,48,14,13,8,9,54,55,50,49,1,2,7,6,57,56,61,62,0,3,4,5,58,59,60,63},{0,1,14,15,16,19,20,21,3,2,13,12,17,18,23,22,4,7,8,11,30,29,24,25,5,6,9,10,31,28,27,26,58,57,54,53,32,35,36,37,59,56,55,52,33,34,39,38,60,61,50,51,46,45,40,41,63,62,49,48,47,44,43,42}}
自适应修正滤波操作
若当前自适应修正滤波单元的左边界外为图像边界,或位于片边界外且CplfEnableFlag的值为0,则左边界外不存在,否则左边界外为当前自适应修正滤波单元左移3个样本点到当前自适应修正滤波单元的区域。
若当前自适应修正滤波单元的右边界外为图像边界,或位于片边界外且CplfEnableFlag的值为0,则右边界外不存在,否则右边界外区域为当前自适应修正滤波单元左移3个样本点到当前自适应修正滤波单元的区域。
示例性的,边界区域包括左边界外区域与右边界外区域。
若AlfLCUEnableFlag[compIdx][LcuIndex]等于1,则对compIdx分量进行自适应修正滤波,否则不进行自适应修正滤波。
若EalfEnableFlag等于0,则当自适应修正滤波过程中用到的样本为自适应修正滤 波单元内的样本时,直接使用该样本进行滤波;当自适应修正滤波过程中用到的样本不属于自适应修正滤波单元内的样本时,按照如下方式进行滤波:
22.3.1、若该样本在图像边界外,或在片边界外且CplfEnableFlag的值为0,则使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;
22.3.2、若该样本在自适应修正滤波单元上边界或下边界外,则使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波;
22.3.3、若22.3.1和22.3.2中的条件均不满足,则使用该样本进行滤波。
示例性的,自适应修正滤波单元亮度分量的自适应修正滤波操作如下:
ptmp=AlfCoeffLuma[filterIdx][8]*p(x,y)
for(j=0;j<8;j++){
ptmp+=AlfCoeffLuma[filterIdx][j]*(p(x-Hor[j],y-Ver[j])+p(x+Hor[j],y+Ver[j])
}
ptmp=(ptmp+32)>>6
p’(x,y)=Clip3(0,(1<<BitDepth)–1,ptmp)
其中,p(x,y)为偏移后样本,p'(x,y)为重建样本,Hor[j]和Ver[j](j=0~7)。
示例性的,自适应修正滤波单元色度分量的自适应修正滤波操作如下:
ptmp=AlfCoeffChroma[i][8]*p(x,y)
for(j=0;j<8;j++){
ptmp+=AlfCoeffChroma[i][j]*(p(x-Hor[j],y-Ver[j])+p(x+Hor[j],y+Ver[j])
}
ptmp=(ptmp+32)>>6
p’(x,y)=Clip3(0,(1<<BitDepth)–1,ptmp)
其中,p(x,y)为偏移后样本,p'(x,y)为重建样本,Hor[j]和Ver[j](j=0~7),其可表1所示。
表1、样本补偿滤波坐标偏移值
j的值 Hor[j]的值 Ver[j]的值
0 0 3
1 0 2
2 1 1
3 0 1
4 1 -1
5 3 0
6 2 0
7 1 0
若EalfEnableFlag等于1,则当自适应修正滤波过程中用到的样本为自适应修正滤波单元内的样本时,直接使用该样本进行滤波;当自适应修正滤波过程中用到的样本不属于自适应修正滤波单元内的样本时,按照如下方式进行滤波:
22.4.1、若该样本在图像边界外,或在片边界外且CplfEnableFlag的值为0,则:
22.4.1.1、以图4A所示滤波器为例,若该样本对应滤波器形状C1、C2、C6、C4、C5或C10位置时,使用自适应修正滤波单元与边界区域内距离该样本最近的样本代替该样本进行滤波;
22.4.1.2、否则,使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波。
22.4.2、若该样本在自适应修正滤波单元上边界或下边界外,则:
22.4.2.1、以图4A所示滤波器为例,若该样本对应滤波器形状C1、C2、C6、C4、 C5或C10位置时,使用自适应修正滤波单元与边界区域内距离该样本最近的样本代替该样本进行滤波;
22.4.2.2、否则,使用自适应修正滤波单元内距离该样本最近的样本代替该样本进行滤波。
22.4.3、若22.4.1和22.4.2中的条件均不满足,使用该样本进行滤波。
示例性的,自适应修正滤波单元亮度分量的自适应修正滤波操作如下:
ptmp=AlfCoeffLuma[filterIdx][14]*p(x,y)
for(j=0;j<14;j++){
ptmp+=AlfCoeffLuma[filterIdx][j]*(p(x-Hor[j],y-Ver[j])+p(x+Hor[j],y+Ver[j])
}
ptmp=(ptmp+32)>>6
p’(x,y)=Clip3(0,(1<<BitDepth)–1,ptmp)
其中,p(x,y)为偏移后样本,p'(x,y)为重建样本,Hor[j]和Ver[j](j=0~13),其可如表2所示。
示例性的,自适应修正滤波单元色度分量的自适应修正滤波操作如下:
ptmp=AlfCoeffChroma[i][14]*p(x,y)
for(j=0;j<14;j++){
ptmp+=AlfCoeffChroma[i][j]*(p(x-Hor[j],y-Ver[j])+p(x+Hor[j],y+Ver[j])
}
ptmp=(ptmp+32)>>6
p’(x,y)=Clip3(0,(1<<BitDepth)–1,ptmp)
表2、样本补偿滤波坐标偏移值
j的值 Hor[j]的值 Ver[j]的值
0 0 3
1 2 2
2 1 2
3 0 2
4 1 -2
5 2 -2
6 2 1
7 1 1
8 0 1
9 1 -1
10 2 -1
11 3 0
12 2 0
13 1 0
实施例二十三
首先,可将图像进行固定的区域划分,固定的区域划分结果可如图2所示,得到每个区域的索引值。对于其中的每个区域,可考虑对其进行如图15A所示的8种划分,或者,也可保留图15A所示的部分划分方式,如图15B所示。
对于每个区域,编码设备可基于RDO决策,确定最后的划分方式,并将每个区域的划分方式通过码流传给解码设备。示例性的,以图15A中最后一种划分方式为例。最多可将16个固定划分方式得到的区域划分为64个区域。
解码流程中,解码设备可先进行固定的区域划分,然后从码流中读取每个区域的具体划分方式,得到整帧的最后划分方式。示例性的,对于图15A中每一种划分方式,划分后的区域编号可如图15C所示。示例性的,J的值为前一个区域的最大值索引值+1。
实施例二十四
以固定区域划分的最小单元是LCU为例,当图像分辨率较小时,存在某些区域只保留编号,区域内没有包含任何图像信息的情况。对于这样的情况,在固定区域划分结果确定后,可确定出具体哪一类不存在图像信息。
示例性的,可根据图像宽和高中包含的LCU个数确定。若固定区域划分为固定的4*4区域,每个区域索引如图2所示,则当宽度或高度上LCU的个数小于4时,会存在某些列或行上的区域不包含图像信息。将所有这些不包含图像信息的区域,记为集合G。集合G的大小记为N7,N7为正整数。
对于所有的索引值中的任一索引值i,
24.1、若i等于集合G中任意一个元素,则i=0;
24.2、若i不等于集合G中的任意一个元素,则若i大于集合G中n个元素,则i=i-k;k≤N7。
上述实施例仅仅是本申请实施例的实现方式的具体示例,而并不是对本申请保护范围的限定,基于上述实施例,可通过实施例之间的组合,或对实施例进行变型,得到新的实施例,其均应属于本申请的保护范围。
此外,上述各实施例编码端和解码端的实现流程可相互参照。
以上对本申请提供的方法进行了描述。下面对本申请提供的装置进行描述。
本申请实施例提供了一种滤波装置其中,该滤波装置可应用于编码设备或解码设备,该装置可包括滤波单元,用于:确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波;若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,则使用第一滤波器对所述当前自适应修正滤波单元进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,则使用第二滤波器对所述当前自适应修正滤波单元进行自适应修正滤波。其中,所述第一滤波器可为7*7十字形加5*5方形的中心对称滤波器;所述第二滤波器可为7*7十字形加3*3方形的中心对称滤波器。
在一种可能的实施方式中,所述滤波单元,还用于在对当前自适应修正滤波单元内的当前滤波像素进行自适应修正滤波的过程中,对于所述当前滤波像素的任一参考像素,当该参考像素处于所述当前自适应修正滤波单元内时,使用该参考像素的像素值进行自适应修正滤波;当该参考像素未处于所述当前自适应修正滤波单元内时,在无法获取到该参考像素的像素值的情况下,使用所述当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波,在获取到该参考像素的像素值的情况下,使用该参考像素的像素值进行自适应修正滤波。
在一种可能的实施方式中,所述无法获取到该参考像素的像素值的情况包括以下之一:该参考像素处于当前图像帧的图像边界外;该参考像素处于当前片的片边界外且不允许跨越片边界进行滤波;该参考像素处于所述当前自适应修正滤波单元的上边界外;或该参考像素处于所述当前自适应修正滤波单元的下边界外。
在一种可能的实施方式中,所述滤波单元,还用于:若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波。
一种可能的实施方式中,所述滤波单元确定所述当前自适应修正滤波单元是否允许使用增强自适应修正滤波,包括:确定用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位取值,在所述标志位取值为第一取值时,确定当前自适应修正滤波单元允许使用增强自适应修正滤波,在所述标志位取值为第二取值时,确定当前自适应修正滤波单元不允许使用增强自适应修正滤波。
一种可能的实施方式中,所述用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位为EalfEnableFlag;所述EalfEnableFlag的值从所述解码设备导出,或在所述解码设备处由码流中获取所述EalfEnableFlag的值,或所述EalfEnableFlag的值为一个常值。
在一种可能的实施方式中,在所述解码设备处由码流中获取所述EalfEnableFlag的值,包括:基于从所述码流中解析得到的增强自适应修正滤波允许标志的值,确定所述EalfEnableFlag的值。其中,所述增强自适应修正滤波允许标志为序列级参数。
请参见图16,图16是本申请实施例提供的一种滤波装置的结构示意图,其中,该滤波装置可应用于编码/解码设备,该装置可包括滤波单元1610,用于:在对当前自适应修正滤波单元内的当前滤波像素进行ALF滤波的过程中,对于所述当前滤波像素的任一参考像素,当该参考像素处于所述当前自适应修正滤波单元内时,使用该参考像素的像素值进行自适应修正滤波;当该参考像素未处于所述当前自适应修正滤波单元内时,在无法获取到该参考像素的像素值的情况下,使用所述当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行滤波,在获取到该参考像素的像素值的情况下,使用该参考像素的像素值进行滤波。
在一种可能的实施方式中,所述无法获取到该参考像素的像素值的情况包括以下之一:该参考像素处于当前图像帧的图像边界外、处于当前片的片边界外且不允许跨越片边界进行滤波、处于所述当前自适应修正滤波单元的上边界外或下边界外。
请参见图17,图17是本申请实施例提供的一种滤波装置的结构示意图,其中,该滤波装置可应用于编码/解码设备,该装置可包括滤波单元1710,用于:确定所述当前自适应修正滤波单元是否允许使用增强自适应修正滤波;若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,则使用第一滤波器对所述当前自适应修正滤波单元进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,则使用第二滤波器对所述当前自适应修正滤波单元进行自适应修正滤波。其中,所述第一滤波器为7*7十字形加5*5方形的中心对称滤波器;所述第二滤波器为7*7十字形加3*3方形的中心对称滤波器。
在一种可能的实施方式中,所述滤波单元1710确定所述当前自适应修正滤波单元是否允许使用增强自适应修正滤波,包括:确定用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位取值,在所述标志位取值为第一取值时确定当前自适应修正滤波单元允许使用增强自适应修正滤波,在所述标志位取值为第二取值时确定当前自适应修正滤波单元不允许使用增强自适应修正滤波。
在一种可能的实施方式中,所述滤波单元1710还用于:在对当前自适应修正滤波单元内的当前滤波像素进行自适应修正滤波的过程中,对于所述当前滤波像素的任一参考像素,当该参考像素处于所述当前自适应修正滤波单元内时,使用该参考像素的像素值进行自适应修正滤波;当该参考像素未处于所述当前自适应修正滤波单元内时,在无法获取到该参考像素的像素值的情况下,使用所述当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波,在获取到该参考像素的像素值的情况下,使用该参考像素的像素值进行自适应修正滤波。
在一种可能的实施方式中,所述无法获取到该参考像素的像素值的情况包括以下之一:该参考像素处于当前图像帧的图像边界外、处于当前片的片边界外且不允许跨越片边界进行滤波、处于所述当前自适应修正滤波单元的上边界外或下边界外。
在一种可能的实施方式中,所述滤波单元1710还用于:若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正 滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波。
请参见图18,为本申请实施例提供的一种解码设备的硬件结构示意图。该解码设备可包括处理器1801、存储有机器可执行指令的机器可读存储介质1802。处理器1801与机器可读存储介质1802可经由系统总线1803通信。并且,通过读取并执行机器可读存储介质1802中与滤波控制逻辑对应的机器可执行指令,处理器1801可执行上文描述的应用于解码设备的滤波方法。
本文中提到的机器可读存储介质1802可是任何电子、磁性、光学或其它物理存储装置,可包含或存储信息,如可执行指令、数据,等等。例如,机器可读存储介质可是:RAM(Radom Access Memory,随机存取存储器)、易失存储器、非易失性存储器、闪存、存储驱动器(如硬盘驱动器)、固态硬盘、任何类型的存储盘(如光盘、dvd等),或者类似的存储介质,或者它们的组合。
在一些实施例中,还提供了一种机器可读存储介质,该机器可读存储介质内存储有机器可执行指令,所述机器可执行指令被处理器执行时实现上文描述的应用于解码设备的滤波方法。例如,所述机器可读存储介质可是ROM、RAM、CD-ROM、磁带、软盘和光数据存储设备等。
请参见图19,为本申请实施例提供的一种编码设备的硬件结构示意图。该编码设备可包括处理器1901、存储有机器可执行指令的机器可读存储介质1902。处理器1901与机器可读存储介质1902可经由系统总线1903通信。并且,通过读取并执行机器可读存储介质1902中与滤波控制逻辑对应的机器可执行指令,处理器1901可执行上文描述的应用于编码设备的滤波方法。
本文中提到的机器可读存储介质1902可是任何电子、磁性、光学或其它物理存储装置,可包含或存储信息,如可执行指令、数据,等等。例如,机器可读存储介质可是:RAM(Radom Access Memory,随机存取存储器)、易失存储器、非易失性存储器、闪存、存储驱动器(如硬盘驱动器)、固态硬盘、任何类型的存储盘(如光盘、dvd等),或者类似的存储介质,或者它们的组合。
在一些实施例中,还提供了一种机器可读存储介质,该机器可读存储介质内存储有机器可执行指令,所述机器可执行指令被处理器执行时实现上文描述的应用于编码设备的滤波方法。例如,所述机器可读存储介质可是ROM、RAM、CD-ROM、磁带、软盘和光数据存储设备等。
在一些实施例中,还提供了一种摄像机设备,包括上述任一实施例中的滤波装置。
需要说明的是,在本文中,诸如第一和第二等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上所述仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。

Claims (18)

  1. 一种滤波方法,应用于编码设备或解码设备,其特征在于,所述方法包括:
    确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波;
    若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,则使用第一滤波器对所述当前自适应修正滤波单元进行自适应修正滤波;
    若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,则使用第二滤波器对所述当前自适应修正滤波单元进行自适应修正滤波,
    其中,所述第一滤波器为7*7十字形加5*5方形的中心对称滤波器;所述第二滤波器为7*7十字形加3*3方形的中心对称滤波器。
  2. 根据权利要求1所述的方法,其特征在于,在对当前自适应修正滤波单元内的当前滤波像素进行自适应修正滤波的过程中,对于所述当前滤波像素的任一参考像素,
    当该参考像素处于所述当前自适应修正滤波单元内时,使用该参考像素的像素值进行自适应修正滤波;
    当该参考像素未处于所述当前自适应修正滤波单元内时:
    在无法获取到该参考像素的像素值的情况下,使用所述当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;
    在获取到该参考像素的像素值的情况下,使用该参考像素的像素值进行自适应修正滤波。
  3. 根据权利要求2所述的方法,其特征在于,所述无法获取到该参考像素的像素值的情况包括以下之一:
    该参考像素处于当前图像帧的图像边界外;
    该参考像素处于当前片的片边界外、且不允许跨越片边界进行滤波;
    该参考像素处于所述当前自适应修正滤波单元的上边界外;或
    该参考像素处于所述当前自适应修正滤波单元的下边界外。
  4. 根据权利要求2或3所述的方法,其特征在于,所述方法还包括:
    若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;
    若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波。
  5. 根据权利要求1所述的方法,其特征在于,确定所述当前自适应修正滤波单元是否允许使用增强自适应修正滤波,包括:
    确定用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位取值,
    在所述标志位取值为第一取值时,确定当前自适应修正滤波单元允许使用增强自适应修正滤波,
    在所述标志位取值为第二取值时,确定当前自适应修正滤波单元不允许使用增强自适应修正滤波。
  6. 根据权利要求5所述的方法,其特征在于,
    所述用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位为EalfEnableFlag;
    所述EalfEnableFlag的值从所述解码设备导出,或在所述解码设备处由码流中获取所述EalfEnableFlag的值,或者所述EalfEnableFlag的值为一个常值。
  7. 根据权利要求6所述的方法,其特征在于,在所述解码设备处由码流中获取所 述EalfEnableFlag的值,包括:
    基于从所述码流中解析得到的增强自适应修正滤波允许标志的值,确定所述EalfEnableFlag的值;
    其中,所述增强自适应修正滤波允许标志为序列级参数。
  8. 一种滤波装置,应用于编码设备或解码设备,其特征在于,所述装置包括:
    滤波单元,用于确定当前自适应修正滤波单元是否允许使用增强自适应修正滤波;
    所述滤波单元,还用于若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,则使用第一滤波器对所述当前自适应修正滤波单元进行自适应修正滤波;
    若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,则使用第二滤波器对所述当前自适应修正滤波单元进行自适应修正滤波,
    其中,所述第一滤波器为7*7十字形加5*5方形的中心对称滤波器;所述第二滤波器为7*7十字形加3*3方形的中心对称滤波器。
  9. 根据权利要求8所述的装置,其特征在于,所述滤波单元还用于:在对当前自适应修正滤波单元内的当前滤波像素进行自适应修正滤波的过程中,对于所述当前滤波像素的任一参考像素,
    当该参考像素处于所述当前自适应修正滤波单元内时,使用该参考像素的像素值进行自适应修正滤波;
    当该参考像素未处于所述当前自适应修正滤波单元内时:
    在无法获取到该参考像素的像素值的情况下,使用所述当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;
    在获取到该参考像素的像素值的情况下,使用该参考像素的像素值进行自适应修正滤波。
  10. 根据权利要求9所述的装置,其特征在于,所述无法获取到该参考像素的像素值的情况包括以下之一:
    该参考像素处于当前图像帧的图像边界外;
    该参考像素处于当前片的片边界外且不允许跨越片边界进行滤波;
    该参考像素处于所述当前自适应修正滤波单元的上边界外;或
    该参考像素处于所述当前自适应修正滤波单元的下边界外。
  11. 根据权利要求9或10所述的装置,其特征在于,所述滤波单元,还用于
    若确定当前自适应修正滤波单元允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波;
    若确定当前自适应修正滤波单元不允许使用增强自适应修正滤波,且用于进行当前自适应修正滤波单元的自适应修正滤波的像素位置的像素值无法获取,则使用当前自适应修正滤波单元内距离该参考像素位置最近的像素代替该参考像素进行自适应修正滤波。
  12. 根据权利要求8所述的装置,其特征在于,所述滤波单元确定所述当前自适应修正滤波单元是否允许使用增强自适应修正滤波,包括:
    确定用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志位取值,
    在所述标志位取值为第一取值时,确定当前自适应修正滤波单元允许使用增强自适应修正滤波,
    在所述标志位取值为第二取值时,确定当前自适应修正滤波单元不允许使用增强自适应修正滤波。
  13. 根据权利要求12所述的装置,其特征在于,
    所述用于指示当前自适应修正滤波单元是否允许使用增强自适应修正滤波的标志 位为EalfEnableFlag;
    所述EalfEnableFlag的值从所述解码设备导出,或在所述解码设备处由码流中获取所述EalfEnableFlag的值,或所述EalfEnableFlag的值为一个常值。
  14. 根据权利要求13所述的装置,其特征在于,在所述解码设备处由码流中获取所述EalfEnableFlag的值,包括:
    基于从所述码流中解析得到的增强自适应修正滤波允许标志的值,确定所述EalfEnableFlag的值;
    其中,所述增强自适应修正滤波允许标志为序列级参数。
  15. 一种解码设备,其特征在于,包括处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令,所述处理器用于执行机器可执行指令,以实现如权利要求1至7任一项所述的滤波方法。
  16. 一种编码设备,其特征在于,包括处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令,所述处理器用于执行机器可执行指令,以实现如权利要求1至7任一项所述的滤波方法。
  17. 一种非易失性存储介质,其上存储有机器可执行指令,所述机器可执行指令被处理器执行时,促使所述处理器实现如权利要求1至7任一项所述的滤波方法。
  18. 一种摄像机设备,包括如权利要求8至14任一项所述的滤波装置。
PCT/CN2022/078876 2021-03-05 2022-03-02 用于滤波的方法、装置及设备 WO2022184109A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
JP2023547310A JP2024506002A (ja) 2021-03-05 2022-03-02 フィルタリングのための方法、装置及びデバイス
US18/262,227 US20240146916A1 (en) 2021-03-05 2022-03-02 Filtering method and apparatus and devices
KR1020237024597A KR20230119718A (ko) 2021-03-05 2022-03-02 필터링에 사용되는 방법, 장치 및 기기

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110247471.2A CN114640858B (zh) 2021-03-05 2021-03-05 滤波方法、装置及设备
CN202110247471.2 2021-03-05

Publications (1)

Publication Number Publication Date
WO2022184109A1 true WO2022184109A1 (zh) 2022-09-09

Family

ID=78980555

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/078876 WO2022184109A1 (zh) 2021-03-05 2022-03-02 用于滤波的方法、装置及设备

Country Status (6)

Country Link
US (1) US20240146916A1 (zh)
JP (1) JP2024506002A (zh)
KR (1) KR20230119718A (zh)
CN (2) CN114640858B (zh)
TW (1) TWI806468B (zh)
WO (1) WO2022184109A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114640858B (zh) * 2021-03-05 2023-05-26 杭州海康威视数字技术股份有限公司 滤波方法、装置及设备

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120177104A1 (en) * 2011-01-12 2012-07-12 Madhukar Budagavi Reduced Complexity Adaptive Loop Filter (ALF) for Video Coding
US20120189064A1 (en) * 2011-01-14 2012-07-26 Ebrisk Video Inc. Adaptive loop filtering using multiple filter shapes
CN104702963A (zh) * 2015-02-13 2015-06-10 北京大学 一种自适应环路滤波的边界处理方法及装置
CN105306957A (zh) * 2015-10-23 2016-02-03 北京中星微电子有限公司 自适应环路滤波方法和设备
US20180324420A1 (en) * 2015-11-10 2018-11-08 Vid Scale, Inc. Systems and methods for coding in super-block based video coding framework
EP3481064A1 (en) * 2017-11-06 2019-05-08 Dolby Laboratories Licensing Corp. Adaptive loop filtering for high dynamic range video
CN113824956A (zh) * 2020-08-24 2021-12-21 杭州海康威视数字技术股份有限公司 滤波方法、装置、设备及机器可读存储介质
CN113852831A (zh) * 2021-03-05 2021-12-28 杭州海康威视数字技术股份有限公司 滤波方法、装置、设备及机器可读存储介质

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102857751B (zh) * 2011-07-01 2015-01-21 华为技术有限公司 一种视频编解码方法和装置
KR102276854B1 (ko) * 2014-07-31 2021-07-13 삼성전자주식회사 인루프 필터 파라미터 예측을 사용하는 비디오 부호화 방법 및 그 장치, 비디오 복호화 방법 및 그 장치
WO2018170801A1 (zh) * 2017-03-22 2018-09-27 华为技术有限公司 图像滤波方法及装置
WO2019204672A1 (en) * 2018-04-19 2019-10-24 Huawei Technologies Co., Ltd. Interpolation filter for an intra prediction apparatus and method for video coding
WO2020185879A1 (en) * 2019-03-11 2020-09-17 Dolby Laboratories Licensing Corporation Video coding using reference picture resampling supporting region of interest
US11546587B2 (en) * 2019-04-11 2023-01-03 Mediatek Inc. Adaptive loop filter with adaptive parameter set

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120177104A1 (en) * 2011-01-12 2012-07-12 Madhukar Budagavi Reduced Complexity Adaptive Loop Filter (ALF) for Video Coding
US20120189064A1 (en) * 2011-01-14 2012-07-26 Ebrisk Video Inc. Adaptive loop filtering using multiple filter shapes
CN104702963A (zh) * 2015-02-13 2015-06-10 北京大学 一种自适应环路滤波的边界处理方法及装置
CN105306957A (zh) * 2015-10-23 2016-02-03 北京中星微电子有限公司 自适应环路滤波方法和设备
US20180324420A1 (en) * 2015-11-10 2018-11-08 Vid Scale, Inc. Systems and methods for coding in super-block based video coding framework
EP3481064A1 (en) * 2017-11-06 2019-05-08 Dolby Laboratories Licensing Corp. Adaptive loop filtering for high dynamic range video
CN113824956A (zh) * 2020-08-24 2021-12-21 杭州海康威视数字技术股份有限公司 滤波方法、装置、设备及机器可读存储介质
CN113852831A (zh) * 2021-03-05 2021-12-28 杭州海康威视数字技术股份有限公司 滤波方法、装置、设备及机器可读存储介质

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
D. SOCEK (INTEL), A. PURI (INTEL): "Alternate ALF filter shapes for luma", 125. MPEG MEETING; 20190114 - 20190118; MARRAKECH; (MOTION PICTURE EXPERT GROUP OR ISO/IEC JTC1/SC29/WG11), 8 January 2019 (2019-01-08), pages 1 - 4, XP030214025 *
J. TAQUET (CANON), P. ONNO (CANON), C. GISQUET (CANON), G. LAROCHE (CANON): "CE5-4: alternative luma filter sets and alternative chroma filters for ALF", 15. JVET MEETING; 20190703 - 20190712; GOTHENBURG; (THE JOINT VIDEO EXPLORATION TEAM OF ISO/IEC JTC1/SC29/WG11 AND ITU-T SG.16 ), 18 June 2019 (2019-06-18), Gothenburg SE, pages 1 - 6, XP030205630 *

Also Published As

Publication number Publication date
TWI806468B (zh) 2023-06-21
CN113852831B (zh) 2023-03-28
KR20230119718A (ko) 2023-08-16
US20240146916A1 (en) 2024-05-02
TW202241128A (zh) 2022-10-16
CN114640858A (zh) 2022-06-17
CN113852831A (zh) 2021-12-28
CN114640858B (zh) 2023-05-26
JP2024506002A (ja) 2024-02-08

Similar Documents

Publication Publication Date Title
KR20190043482A (ko) 영상 부호화/복호화 방법, 장치 및 비트스트림을 저장한 기록 매체
CN110024385B (zh) 影像编码/解码方法、装置以及对比特流进行存储的记录介质
WO2022104498A1 (zh) 帧内预测方法、编码器、解码器以及计算机存储介质
WO2018219663A1 (en) A method and a device for picture encoding and decoding
CN113727106B (zh) 视频编码、解码方法、装置、电子设备及存储介质
US20230209051A1 (en) Filtering method and apparatus, and device
KR20200010113A (ko) 지역 조명 보상을 통한 효과적인 비디오 부호화/복호화 방법 및 장치
WO2018219664A1 (en) A method and a device for picture encoding and decoding
WO2023065891A1 (zh) 多媒体数据处理方法、装置、设备、计算机可读存储介质及计算机程序产品
JP2022544438A (ja) ループ内フィルタリングの方法及びループ内フィルタリングの装置
WO2022184109A1 (zh) 用于滤波的方法、装置及设备
CN112929656B (zh) 滤波方法、装置及设备
CN114598867B (zh) 滤波方法、装置及设备
WO2022174469A1 (zh) 一种光照补偿方法、编码器、解码器及存储介质
CN114640846A (zh) 滤波方法、装置及设备
CN118101933A (zh) 滤波方法、装置及设备
TWI826792B (zh) 圖像增強方法及裝置
TWI834773B (zh) 使用適應性迴路濾波器以編碼和解碼影像之一或多個影像部分的方法、裝置和電腦可讀儲存媒體
CN113727103B (zh) 视频编码、解码方法、装置、电子设备及存储介质
WO2024007116A1 (zh) 解码方法、编码方法、解码器以及编码器

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22762572

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 20237024597

Country of ref document: KR

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 18262227

Country of ref document: US

WWE Wipo information: entry into national phase

Ref document number: 2023547310

Country of ref document: JP

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22762572

Country of ref document: EP

Kind code of ref document: A1