CN113473129B - An encoding and decoding method and device - Google Patents
An encoding and decoding method and device Download PDFInfo
- Publication number
- CN113473129B CN113473129B CN202010239734.0A CN202010239734A CN113473129B CN 113473129 B CN113473129 B CN 113473129B CN 202010239734 A CN202010239734 A CN 202010239734A CN 113473129 B CN113473129 B CN 113473129B
- Authority
- CN
- China
- Prior art keywords
- current block
- transformation
- target
- coefficient matrix
- value
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods 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/136—Incoming video signal characteristics or properties
- H04N19/137—Motion inside a coding unit, e.g. average field, frame or block difference
- H04N19/139—Analysis of motion vectors, e.g. their magnitude, direction, variance or reliability
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods 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/146—Data rate or code amount at the encoder output
- H04N19/147—Data rate or code amount at the encoder output according to rate distortion criteria
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/134—Methods 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/157—Assigned coding mode, i.e. the coding mode being predefined or preselected to be further used for selection of another element or parameter
- H04N19/159—Prediction type, e.g. intra-frame, inter-frame or bidirectional frame prediction
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/44—Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder
- H04N19/45—Decoders specially adapted therefor, e.g. video decoders which are asymmetric with respect to the encoder performing compensation of the inverse transform mismatch, e.g. Inverse Discrete Cosine Transform [IDCT] mismatch
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/80—Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation
- H04N19/82—Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation involving filtering within a prediction loop
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/90—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using coding techniques not provided for in groups H04N19/10-H04N19/85, e.g. fractals
- H04N19/91—Entropy coding, e.g. variable length coding [VLC] or arithmetic coding
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Physics & Mathematics (AREA)
- Discrete Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
本申请提供一种编码、解码方法及装置,该编码方法包括:获取当前块对应的残差系数矩阵;对所述残差系数矩阵进行初始变换,得到初始变换系数矩阵;若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第一预设条件,则确定当前块是否满足第二预设条件;若当前块满足第二预设条件,则根据所述当前块对应的率失真代价值,确定是否对所述当前块进行二次变换;其中,所述第一预设条件包括:所述当前块的预测模式为帧内预测模式;所述第二预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。通过本申请提高编码性能。
The present application provides an encoding and decoding method and device. The encoding method includes: obtaining a residual coefficient matrix corresponding to the current block; performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix; if the current block supports secondary Transformation, the current block supports the optional secondary transform AST technology, and the current block meets the first preset condition, then determine whether the current block meets the second preset condition; if the current block meets the second preset condition, then according to the The rate-distortion cost value corresponding to the current block determines whether to perform secondary transformation on the current block; wherein, the first preset condition includes: the prediction mode of the current block is an intra-frame prediction mode; the second prediction The assumed condition includes: the current block uses an intra-frame prediction filtering mode, or does not use an intra-frame prediction filtering mode. Improve encoding performance with this application.
Description
技术领域technical field
本申请涉及编解码技术领域,尤其是涉及一种编码、解码方法及装置。The present application relates to the technical field of encoding and decoding, and in particular, relates to an encoding and decoding method and device.
背景技术Background technique
为了达到节约空间的目的,视频图像是经过编码后才传输的,完整的视频编码方法可以包括预测、变换、量化、熵编码、滤波等过程。预测编码可以包括帧内编码和帧间编码。帧间编码是利用视频时间域的相关性,使用邻近已编码图像的像素预测当前图像的像素,达到去除视频时域冗余的目的。帧内编码是考虑到相邻块之间存在很强的空域相关性,利用周围已经重建的像素作为参考像素,对当前未编码块进行预测,只需要对残差值进行后续的编码处理,而不是对原始值进行编码,有效去除空域上的冗余,大大提高了压缩效率。In order to achieve the purpose of saving space, video images are transmitted after encoding, and a complete video encoding method may include processes such as prediction, transformation, quantization, entropy encoding, and filtering. Predictive coding may include intra coding and inter coding. Inter-frame coding is to use the correlation of the video time domain to predict the pixels of the current image by using the pixels of the adjacent coded image, so as to achieve the purpose of removing the redundancy of the video time domain. Intra-frame coding takes into account the strong spatial correlation between adjacent blocks, uses the surrounding reconstructed pixels as reference pixels to predict the current uncoded block, and only needs to perform subsequent coding processing on the residual value, while Instead of encoding the original value, the redundancy in the airspace is effectively removed, and the compression efficiency is greatly improved.
在视频的编码过程中,变换是指将以空间域中像素形式描述的图像转换至变换域的图像,并以变换系数的形式来表示。由于绝大多数图像都含有较多平坦区域和缓慢变化的区域,因此,适当的变换过程,可以使图像能量在空间域的分散分布,转换为在变换域的相对集中分布,从而能够去除信号之间的频域相关性,配合量化过程,可以有效压缩码流。In the video coding process, transformation refers to converting an image described in the form of pixels in the spatial domain to an image in the transform domain, and expressing it in the form of transform coefficients. Since most images contain more flat areas and slowly changing areas, an appropriate transformation process can transform the scattered distribution of image energy in the spatial domain into a relatively concentrated distribution in the transformed domain, thereby eliminating signal differences. The frequency domain correlation among them, together with the quantization process, can effectively compress the code stream.
针对变换过程,在相关技术中提出了二次变换技术。二次变换技术是指:首先进行初始变换,得到初始变换后的变换系数。然后,对初始变换后的变换系数进行二次变换,得到新的变换系数。然后,对新的变换系数进行量化和熵编码等过程。但是,在实际应用中,进行初始变换后,如果初始变换后的变换系数的能量已经足够集中,那么,再对初始变换后的变换系数进行二次变换时,可能会出现过拟合现象,从而导致编码性能比较差等问题。For the transformation process, a secondary transformation technique is proposed in the related art. The secondary transformation technique refers to: performing an initial transformation first to obtain transformation coefficients after the initial transformation. Then, the transformation coefficients after the initial transformation are transformed twice to obtain new transformation coefficients. Then, processes such as quantization and entropy coding are performed on the new transform coefficients. However, in practical applications, after the initial transformation, if the energy of the transformation coefficients after the initial transformation is concentrated enough, then when the transformation coefficients after the initial transformation are transformed again, overfitting may occur, thus Leading to problems such as poor encoding performance.
发明内容Contents of the invention
本申请提供一种编码方法,应用于编码端,所述方法包括:This application provides an encoding method, which is applied to the encoding end, and the method includes:
获取当前块对应的残差系数矩阵;Obtain the residual coefficient matrix corresponding to the current block;
对所述残差系数矩阵进行初始变换,得到初始变换系数矩阵;performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第一预设条件,则确定当前块是否满足第二预设条件;若当前块满足第二预设条件,则根据所述当前块对应的率失真代价值,确定是否对所述当前块进行二次变换;If the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block satisfies the first preset condition, then determine whether the current block satisfies the second preset condition; if the current block satisfies the second preset condition condition, then determine whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block;
其中,所述第一预设条件包括:所述当前块的预测模式为帧内预测模式;所述第二预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。Wherein, the first preset condition includes: the prediction mode of the current block is an intra-frame prediction mode; the second preset condition includes: the current block uses an intra-frame prediction filtering mode, or does not use an intra-frame prediction mode. Predictive filtering mode.
本申请提供一种解码方法,应用于解码端,所述方法包括:This application provides a decoding method, which is applied to the decoding end, and the method includes:
获取当前块的编码比特流;Get the encoded bitstream of the current block;
若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第三预设条件,则确定当前块是否满足第四预设条件;若当前块满足第四预设条件,则根据所述编码比特流中的指示信息或者目标变换系数矩阵确定是否对所述当前块进行二次逆变换;If the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block meets the third preset condition, then determine whether the current block meets the fourth preset condition; if the current block meets the fourth preset condition condition, then determine whether to perform a second inverse transform on the current block according to the indication information in the coded bit stream or the target transform coefficient matrix;
其中,所述第三预设条件包括:所述当前块的预测模式为帧内预测模式;所述第四预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。Wherein, the third preset condition includes: the prediction mode of the current block is an intra-frame prediction mode; the fourth preset condition includes: the current block uses an intra-frame prediction filtering mode, or does not use an intra-frame prediction mode. Predictive filtering mode.
本申请提供一种编码装置,应用于编码端,所述装置包括:The present application provides an encoding device, which is applied to the encoding end, and the device includes:
获取模块,用于获取当前块对应的残差系数矩阵;An acquisition module, configured to acquire a residual coefficient matrix corresponding to the current block;
变换模块,用于对所述残差系数矩阵进行初始变换,得到初始变换系数矩阵;A transformation module, configured to perform an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
确定模块,用于若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第一预设条件,则确定当前块是否满足第二预设条件;若当前块满足第二预设条件,则根据所述当前块对应的率失真代价值,确定是否对所述当前块进行二次变换;A determining module, configured to determine whether the current block satisfies the second preset condition if the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block satisfies the first preset condition; if the current block If the second preset condition is met, determine whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block;
其中,所述第一预设条件包括:所述当前块的预测模式为帧内预测模式;所述第二预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。Wherein, the first preset condition includes: the prediction mode of the current block is an intra-frame prediction mode; the second preset condition includes: the current block uses an intra-frame prediction filtering mode, or does not use an intra-frame prediction mode. Predictive filtering mode.
本申请提供一种解码装置,应用于解码端,所述装置包括:The present application provides a decoding device, which is applied to the decoding end, and the device includes:
获取模块,用于获取当前块的编码比特流;An acquisition module, configured to acquire the coded bitstream of the current block;
确定模块,用于若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第三预设条件,则确定当前块是否满足第四预设条件;若当前块满足第四预设条件,则根据所述编码比特流中的指示信息或者目标变换系数矩阵确定是否对所述当前块进行二次逆变换;其中,所述第三预设条件包括:所述当前块的预测模式为帧内预测模式;所述第四预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。A determining module, configured to determine whether the current block satisfies the fourth preset condition if the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block satisfies the third preset condition; if the current block If the fourth preset condition is met, then it is determined whether to perform a second inverse transform on the current block according to the indication information in the coded bit stream or the target transform coefficient matrix; wherein, the third preset condition includes: the current block The prediction mode of the block is an intra prediction mode; the fourth preset condition includes: the current block uses an intra prediction filtering mode, or does not use an intra prediction filtering mode.
本申请提供一种编码端设备,包括:处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;The present application provides 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 processor is used to execute machine-executable instructions to implement the following steps:
获取模块,用于获取当前块的编码比特流;An acquisition module, configured to acquire the coded bitstream of the current block;
确定模块,用于若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第三预设条件,则确定当前块是否满足第四预设条件;若当前块满足第四预设条件,则根据所述编码比特流中的指示信息或者目标变换系数矩阵确定是否对所述当前块进行二次逆变换;其中,所述第三预设条件包括:所述当前块的预测模式为帧内预测模式;所述第四预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。A determining module, configured to determine whether the current block satisfies the fourth preset condition if the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block satisfies the third preset condition; if the current block If the fourth preset condition is met, then it is determined whether to perform a second inverse transform on the current block according to the indication information in the coded bit stream or the target transform coefficient matrix; wherein, the third preset condition includes: the current block The prediction mode of the block is an intra prediction mode; the fourth preset condition includes: the current block uses an intra prediction filtering mode, or does not use an intra prediction filtering mode.
本申请提供一种解码端设备,包括:处理器和机器可读存储介质,所述机器可读存储介质存储有能够被所述处理器执行的机器可执行指令;The present application provides 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 processor is used to execute machine-executable instructions to implement the following steps:
获取当前块的编码比特流;Get the encoded bitstream of the current block;
若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第三预设条件,则确定当前块是否满足第四预设条件;若当前块满足第四预设条件,则根据所述编码比特流中的指示信息或者目标变换系数矩阵确定是否对所述当前块进行二次逆变换;If the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block meets the third preset condition, then determine whether the current block meets the fourth preset condition; if the current block meets the fourth preset condition condition, then determine whether to perform a second inverse transform on the current block according to the indication information in the coded bit stream or the target transform coefficient matrix;
其中,所述第三预设条件包括:所述当前块的预测模式为帧内预测模式;所述第四预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。Wherein, the third preset condition includes: the prediction mode of the current block is an intra-frame prediction mode; the fourth preset condition includes: the current block uses an intra-frame prediction filtering mode, or does not use an intra-frame prediction mode. Predictive filtering mode.
由以上技术方案可见,本申请实施例中,可以判断是否允许对当前块进行二次变换,从而剔除不需要进行二次变换的块,起到去冗余的作用,从而提高编码性能。It can be seen from the above technical solutions that in the embodiment of the present application, it can be judged whether to allow secondary transformation on the current block, so as to eliminate blocks that do not need to undergo secondary transformation, and play a role in removing redundancy, thereby improving coding performance.
附图说明Description of drawings
图1A-图1C是本申请一种实施方式中的DT划分模式的示意图;1A-1C are schematic diagrams of a DT division mode in an embodiment of the present application;
图1D是本申请一种实施方式中的帧内预测模式的示意图;FIG. 1D is a schematic diagram of an intra prediction mode in an embodiment of the present application;
图1E是本申请一种实施方式中的视频编码框架的示意图;FIG. 1E is a schematic diagram of a video coding framework in an implementation manner of the present application;
图2A是本申请一种实施方式中的编码方法的流程图;FIG. 2A is a flowchart of an encoding method in an embodiment of the present application;
图2B是本申请一种实施方式中的解码方法的流程图;FIG. 2B is a flowchart of a decoding method in an embodiment of the present application;
图3A是本申请一种实施方式中的编码方法的流程图;FIG. 3A is a flowchart of an encoding method in an embodiment of the present application;
图3B是本申请一种实施方式中的解码方法的流程图;FIG. 3B is a flowchart of a decoding method in an embodiment of the present application;
图4A是本申请一种实施方式中的编码方法的流程图;FIG. 4A is a flowchart of an encoding method in an embodiment of the present application;
图4B是本申请一种实施方式中的解码方法的流程图;FIG. 4B is a flowchart of a decoding method in an embodiment of the present application;
图5A是本申请一种实施方式中的编码装置的结构图;FIG. 5A is a structural diagram of an encoding device in an embodiment of the present application;
图5B是本申请一种实施方式中的解码装置的结构图;FIG. 5B is a structural diagram of a decoding device in an embodiment of the present application;
图6A是本申请一种实施方式中的编码端设备的硬件结构图;FIG. 6A is a hardware structural diagram of an encoding end device in an embodiment of the present application;
图6B是本申请一种实施方式中的解码端设备的硬件结构图。FIG. 6B is a hardware structural diagram of a decoder device in an implementation manner of the present application.
具体实施方式detailed description
在本申请实施例中所使用的术语仅仅是出于描述特定实施例的目的,而非用于限制本申请。本申请实施例和权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其它含义。还应当理解,本文中使用的术语“和/或”是指包含一个或多个相关联的列出项目的任何或所有可能组合。应当理解,尽管在本申请实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本申请范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,此外,所使用的词语“如果”可以被解释成为“在……时”,或“当……时”,或“响应于确定”。The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not used to limit the present application. The singular forms of "a", "said" and "the" used in the embodiments and claims of this application are also intended to include plural forms, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items. It should be understood that although the embodiments of the present application may use terms such as first, second, and third to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, without departing from the scope of the present application, first information may also be called second information, and similarly, second information may also be called first information. Depending on the context, furthermore, the use of the word "if" could be interpreted as "at", or "when", or "in response to a determination".
为了使本领域技术人员更好地理解本申请的技术方案,下面对技术术语进行简单说明。In order to enable those skilled in the art to better understand the technical solutions of the present application, the technical terms are briefly explained below.
预测像素(Prediction Signal):是指从已经编解码的像素中导出的像素值,通过原始像素与预测像素之差获得残差,进而进行残差变换,量化以及系数编码等过程。Prediction Signal: Refers to the pixel value derived from the encoded and decoded pixels. The residual is obtained by the difference between the original pixel and the predicted pixel, and then the process of residual transformation, quantization, and coefficient coding is performed.
帧内预测(Intra Prediction):是指通过周边已解码区域的重建像素值来预测当前块的预测值的预测模式。常见的方式包括按照角度方向进行像素拷贝,以及按照一定的渐变原则进行预测值导出的方式。示例性的,帧内预测去除的是视频/图像的空域相关性。Intra prediction (Intra Prediction): refers to the prediction mode that predicts the prediction value of the current block through the reconstructed pixel values of the surrounding decoded area. Common methods include copying pixels according to the angular direction, and deriving predicted values according to a certain gradient principle. Exemplarily, the intra-frame prediction removes the spatial domain correlation of the video/image.
变换核(transform kernel):在视频编码中,变换是实现数据压缩必不可少的阶段,变换能够使信号的能量更加集中,而基于离散余弦变换(DCT,Discrete CosineTransform)/离散正弦变换(DST,Discrete Sine Transform)的变换技术,一直是视频编码主流变换技术。DCT和DST根据基函数的不同又具体分为多种变换核,参见表1所示,示出了三种变换核。Transform kernel: In video coding, transformation is an essential stage for data compression. Transformation can make the energy of the signal more concentrated, and based on discrete cosine transform (DCT, Discrete CosineTransform)/discrete sine transform (DST, Discrete Sine Transform) transformation technology has always been the mainstream transformation technology of video coding. DCT and DST are specifically divided into multiple transformation kernels according to different basis functions, as shown in Table 1, three kinds of transformation kernels are shown.
表1Table 1
正变换(forward transform)和逆变换(inverse transform):在视频编码过程中,包含了正变换和逆变换过程,正变换又称为前向变换,逆变换又称为反向变换。示例性的,正变换是将一个二维残差系数(也可以称为残差信号)转换成能量更加集中的二维变换系数(也可以称为频谱信号),该变换系数再经过量化等过程,就可以有效去除高频成分,保留中低频成分,起到了压缩的作用。例如,可以通过公式(1)的矩阵形式表示正变换过程。Forward transform and inverse transform: In the video coding process, the process of forward transform and inverse transform is included. Forward transform is also called forward transform, and inverse transform is also called inverse transform. Exemplarily, the forward transform is to convert a two-dimensional residual coefficient (also called a residual signal) into a two-dimensional transform coefficient (also called a spectral signal) with more concentrated energy, and the transform coefficient is then subjected to processes such as quantization , it can effectively remove high-frequency components, retain low-frequency components, and play a role in compression. For example, the forward transformation process can be represented by the matrix form of formula (1).
F=B·f·AT 公式(1)F=B·f· AT formula (1)
示例性的,M表示残差块(即残差系数组成的块)的宽度,N表示残差块的高度,f表示N*M维的原始残差信号,F表示N*M维的频域信号(即转换后频域信号),A和B表示M*M和N*N维的变换矩阵,A和B均满足正交性,如表1所示的变换核。Exemplarily, M represents the width of the residual block (that is, a block composed of residual coefficients), N represents the height of the residual block, f represents the original residual signal of N*M dimension, and F represents the frequency domain of N*M dimension Signal (that is, the frequency domain signal after conversion), A and B represent M*M and N*N dimensional transformation matrices, A and B both satisfy orthogonality, as shown in Table 1 Transform kernel.
逆变换可以是正变换的逆过程,即通过变换矩阵A和变换矩阵B,可以将频域信号F转换成时域残差信号f。例如,可以通过公式(2)的矩阵形式表示逆变换过程。The inverse transform can be the reverse process of the forward transform, that is, the frequency domain signal F can be converted into the time domain residual signal f through the transformation matrix A and the transformation matrix B. For example, the inverse transformation process can be represented by the matrix form of formula (2).
f=BT·F·A 公式(2)f=B T F A Formula (2)
水平变换(Horizental transform)和垂直变换(Vertical transform):在编码变换阶段,输入的是二维残差信号,设X=A·fT,则F=B·XT,例如,通过公式(3)的矩阵形式进行表示。Horizontal transform (Horizental transform) and vertical transform (Vertical transform): In the coding transformation stage, the input is a two-dimensional residual signal, assuming X=A·f T , then F=B·X T , for example, through the formula (3 ) in matrix form.
F=B·f·AT=B·(A·fT)T 公式(3)F=B·f· AT =B·(A·f T ) T formula (3)
综上可以看出,二维信号的正变换可以通过两次一维的正变换方式实现,第一次正变换后得到一个M*N的信号X,去除二维残差信号的水平方向像素之间的相关性,因此,第一次正变换称为水平变换,称A为水平变换矩阵。第二次正变换后得到信号F,去除二维残差信号的垂直方向像素之间的相关性,因此,第二次正变换称为垂直变换,称B为垂直变换矩阵。To sum up, it can be seen that the forward transformation of the two-dimensional signal can be realized by two one-dimensional forward transformation methods. After the first forward transformation, an M*N signal X is obtained, and the horizontal pixels of the two-dimensional residual signal are removed. Therefore, the first positive transformation is called the horizontal transformation, and A is called the horizontal transformation matrix. After the second forward transformation, the signal F is obtained, and the correlation between the pixels in the vertical direction of the two-dimensional residual signal is removed. Therefore, the second forward transformation is called vertical transformation, and B is called the vertical transformation matrix.
变换对(Transform pair):也称为变换核对,为了支持矩阵块,M不一定等于N,A和B的维度不一定相等,还可以支持A和B不是同一种变换核生产的变换矩阵,因此,在变换中存在A和B对应的变换核组成的变换对{H,V},H称为水平变换核,V称为垂直变换核。Transform pair (Transform pair): also known as transformation check. In order to support matrix blocks, M is not necessarily equal to N, and the dimensions of A and B are not necessarily equal. It can also support transformation matrices that A and B are not produced by the same transformation kernel, so , in the transformation, there is a transformation pair {H, V} composed of transformation kernels corresponding to A and B, H is called the horizontal transformation kernel, and V is called the vertical transformation kernel.
率失真原则(RDO,Rate-Distortion Optimized):评价编码效率的有两大指标:码率和PSNR(Peak Signal to Noise Ratio,峰值信噪比)。比特流越小,则压缩率越大;PSNR越大,则重建图像质量越好。在模式选择时,判别公式实质上也就是对二者的综合评价。Rate-Distortion Principle (RDO, Rate-Distortion Optimized): There are two indicators for evaluating coding efficiency: code rate and PSNR (Peak Signal to Noise Ratio, peak signal-to-noise ratio). The smaller the bit stream, the greater the compression rate; the greater the PSNR, the better the quality of the reconstructed image. In mode selection, the discriminant formula is essentially a comprehensive evaluation of the two.
模式对应的代价值:J(mode)=D+λ*R。示例性的,D表示Distortion,通常使用SSE指标来衡量,SSE是指重建块与源图像的差值均方和;λ是拉格朗日乘子;R就是该模式下图像块编码所需的实际比特数,包括编码模式信息、运动信息、残差等所需的比特总和。在模式选择时,若使用RDO原则去对编码模式做比较决策,通常可以保证编码性能最佳。The cost value corresponding to the mode: J(mode)=D+λ*R. Exemplarily, D represents Distortion, which is usually measured by the SSE index. SSE refers to the mean square sum of the difference between the reconstruction block and the source image; λ is the Lagrangian multiplier; R is required for image block encoding in this mode The actual number of bits, including the sum of bits required for encoding mode information, motion information, residuals, etc. In mode selection, if the RDO principle is used to make comparison decisions on encoding modes, the best encoding performance can usually be guaranteed.
隐式变换核选择(IST,Implicit Selection of Transform):对于帧内预测残差块,通常使用DCT2变换方法,然而,对于大部分帧内预测残差块,特别是小块,DST7表现出更好的能量集中性,因此基于编码单元(Code Unit,简称CU)-等级(level)的多变换核选择,会进一步带来编码性能的提升。基于此,提出了基于隐式表达的变换核选择方式,即隐藏变换核的标志位(可以称为IST标志位),从而隐式指示对当前块进行变换使用的变换核对。Implicit Transform Kernel Selection (IST, Implicit Selection of Transform): For intra-frame prediction residual blocks, the DCT2 transformation method is usually used, however, for most intra-frame prediction residual blocks, especially small blocks, DST7 performs better Therefore, the multi-transform core selection based on the coding unit (Code Unit, CU for short)-level (level) will further improve the coding performance. Based on this, a transform kernel selection method based on implicit expression is proposed, that is, the flag bit of the transform kernel (which may be called the IST flag bit) is hidden, so as to implicitly indicate the transform kernel used for transforming the current block.
示例性的,编码端需要通过RDO来选择变换核对是采用(DCT2,DCT2)还是采用(DST7,DST7),为了隐藏IST标志位,认为当选择变换核对为(DCT2,DCT2)时,当前块的非零变换系数的个数为偶数,若实际非零个数为奇数,则编码端通过将最后一位非零变换系数置零的方法,使得当前块的非零变换系数的个数一定为偶数。同理,当选择变换核对为(DST7,DST7)时,当前块的非零变换系数的个数为奇数,若实际非零个数为偶数,则编码端通过将最后一位非零变换系数置零的方法,使得当前块的非零变换系数的个数一定为奇数。Exemplarily, the encoder needs to use RDO to select whether the transform check is to use (DCT2, DCT2) or (DST7, DST7). In order to hide the IST flag, it is considered that when the transform check is selected as (DCT2, DCT2), the current block The number of non-zero transform coefficients is an even number. If the actual number of non-zero transform coefficients is an odd number, the encoding end sets the last non-zero transform coefficient to zero, so that the number of non-zero transform coefficients of the current block must be even. Similarly, when the transform check is selected as (DST7, DST7), the number of non-zero transform coefficients of the current block is an odd number, and if the actual number of non-zero transform coefficients is an even number, the encoder sets the last non-zero transform coefficient to The zero method makes the number of non-zero transform coefficients of the current block must be an odd number.
出于硬件实现的角度出发,DST7变换核的硬件实现所需要的乘法次数较多,硬件实现代价比较大。因此,为了降低硬件实现的复杂度,对于变换系数超过一定范围的变换块,可以不使用DST7变换核,具体方法如下:sr_x表示当前变换系数矩阵中最右面的非零变换系数的横坐标,sr_y表示当前变换系数矩阵中最下面的非零变换系数的纵坐标,由sr_x和sr_y可确定当前变换系数矩阵中所有非零变换系数对应的区域,超出该范围的区域变换系数都为0。From the perspective of hardware implementation, the hardware implementation of the DST7 transform core requires more multiplication times, and the cost of hardware implementation is relatively high. Therefore, in order to reduce the complexity of hardware implementation, the DST7 transformation kernel may not be used for transformation blocks whose transformation coefficients exceed a certain range. The specific method is as follows: sr_x represents the abscissa of the rightmost non-zero transformation coefficient in the current transformation coefficient matrix, sr_y Represents the ordinate of the bottom non-zero transform coefficient in the current transform coefficient matrix. The area corresponding to all non-zero transform coefficients in the current transform coefficient matrix can be determined by sr_x and sr_y. The transform coefficients of the area beyond this range are all 0.
由于sr_x和sr_y需要传输到解码端,解码端可以直接得到sr_x和sr_y,当sr_x大于等于16或sr_y大于等于16时,解码端可以直接判定IST使用的变换核为(DCT2,DCT2),不需要再统计非零变换系数的个数的奇偶性;否则,需要确定当前块非零变换系数的个数的奇偶性,若该奇偶性为奇数,则IST使用的变换核为(DST7,DST7),若为该奇偶性为偶数,则IST使用的变换核为(DCT2,DCT2),上述过程可以通过如下公式进行表示:Since sr_x and sr_y need to be transmitted to the decoder, the decoder can directly obtain sr_x and sr_y. When sr_x is greater than or equal to 16 or sr_y is greater than or equal to 16, the decoder can directly determine that the transformation kernel used by the IST is (DCT2, DCT2). Then count the parity of the number of non-zero transform coefficients; otherwise, it is necessary to determine the parity of the number of non-zero transform coefficients of the current block, if the parity is odd, the transform kernel used by IST is (DST7, DST7), If the parity is even, the transformation kernel used by IST is (DCT2, DCT2), and the above process can be expressed by the following formula:
IstTuFlag=(sr_x>=16||sr_y>=16)?0:(num_nz%2?1:0)IstTuFlag=(sr_x>=16||sr_y>=16)? 0:(num_nz%2?1:0)
基于上述分析可以得出,最终,IST变换核的选择方法可以参见表2所示:Based on the above analysis, it can be concluded that finally, the selection method of IST transformation kernel can be seen in Table 2:
表2Table 2
示例性的,IST可以作用于满足以下条件的当前块:当前块为帧内预测模式;当前子块的划分模式为非DT模式;当前块的宽度小于64;当前块的高度小于64。Exemplarily, the IST can be applied to the current block meeting the following conditions: the current block is in intra prediction mode; the division mode of the current sub-block is non-DT mode; the width of the current block is less than 64; the height of the current block is less than 64.
衍生树(Derive Tree,简称DT)划分模式:DT划分模式是一种新的划分模式,产生新的划分形状,能够进一步获得性能增益。示例性的,DT划分模式可以包括水平衍生模式和竖直衍生模式,其示意图可以如图1A所示。DT划分模式还可以生长在四叉树或者二叉树的叶子节点上,参见图1B所示,对于I帧或非I帧,DT划分模式可以通过对CU合并划分边界,得到衍生模式的不同PU划分(2N*hN、2N*nU、2N*nD、hN*2N、nL*2N或nR×2N)。Derive Tree (DT for short) partitioning mode: DT partitioning mode is a new partitioning mode that generates new partitioning shapes and can further obtain performance gains. Exemplarily, the DT division mode may include a horizontal derivation mode and a vertical derivation mode, the schematic diagram of which may be as shown in FIG. 1A . The DT division mode can also be grown on the leaf nodes of the quadtree or the binary tree, as shown in FIG. 1B , for an I frame or a non-I frame, the DT division mode can obtain different PU divisions of the derivative mode by merging and dividing the boundaries of the CU ( 2N*hN, 2N*nU, 2N*nD, hN*2N, nL*2N or nR×2N).
示例性的,对于帧内预测模式来说,使用衍生模式进行预测的当前块,可以使用4个非方块进行变换量化,并不需要引入新的变换核,其示意图可以如图1C所示。Exemplarily, for the intra prediction mode, the current block predicted using the derivative mode can be transformed and quantized using 4 non-blocks without introducing a new transform kernel, and its schematic diagram can be shown in FIG. 1C .
示例性的,使用水平衍生模式的当前块需要满足下面2个条件:高度大于等于16,且小于等于64;宽度与高度的比例小于4。示例性的,使用竖直衍生模式的当前块需要满足下面2个条件:宽度大于等于16,且小于等于64;高度与宽度的比例小于4。Exemplarily, the current block using the horizontal derivation mode needs to meet the following two conditions: the height is greater than or equal to 16 and less than or equal to 64; the ratio of width to height is less than 4. Exemplarily, the current block using the vertical derivative mode needs to meet the following two conditions: the width is greater than or equal to 16 and less than or equal to 64; the ratio of height to width is less than 4.
帧内预测模式:为了支持更精细的角度预测,可以将角度预测模式扩展为62个,在加上3个特殊帧内模式,则一共65种模式。参见图1D所示,为帧内预测模式的示意图,原有的角度预测模式的模式号1-33不变,新增的角度预测模式,模式号从34往后增加至65。Intra-frame prediction mode: In order to support finer angle prediction, the angle prediction mode can be extended to 62, plus 3 special intra-frame modes, a total of 65 modes. Referring to FIG. 1D , which is a schematic diagram of the intra prediction mode, the mode numbers 1-33 of the original angle prediction mode remain unchanged, and the mode number of the newly added angle prediction mode increases from 34 to 65.
视频编码框架:参见图1E示,可以使用视频编码框架实现本申请实施例中的编码端处理流程,视频解码框架的示意图与图1E类似,在此不再重复赘述,可以使用视频解码框架实现本申请实施例中的解码端处理流程。在视频编码框架和视频解码框架中,可以包括但不限于:帧内预测、运动估计/运动补偿、参考图像缓冲器、环内滤波、重建、变换、量化、反变换、反量化、熵编码器等模块。在编码端,通过这些模块之间的配合,可以实现编码端的处理流程,在解码端,通过这些模块之间的配合,可以实现解码端的处理流程。Video encoding framework: Refer to Figure 1E, the video encoding framework can be used to implement the encoding end processing flow in the embodiment of this application, the schematic diagram of the video decoding framework is similar to Figure 1E, and will not be repeated here, and the video decoding framework can be used to implement this The processing flow of the decoding end in the application embodiment. In the video encoding framework and video decoding framework, it may include but not limited to: intra prediction, motion estimation/motion compensation, reference image buffer, in-loop filtering, reconstruction, transformation, quantization, inverse transformation, inverse quantization, entropy encoder and other modules. At the encoding end, through the cooperation between these modules, the processing flow at the encoding end can be realized, and at the decoding end, through the cooperation between these modules, the processing flow at the decoding end can be realized.
示例性的,在视频编码过程中,变换是指将以空间域中像素形式描述的图像转换至变换域的图像,并以变换系数的形式来表示。由于绝大多数图像都含有较多平坦区域和缓慢变化的区域,因此,适当的变换过程,可以使图像能量在空间域的分散分布,转换为在变换域的相对集中分布,从而能够去除信号之间的频域相关性,配合量化过程,可以有效压缩码流。Exemplarily, in a video coding process, transformation refers to transforming an image described in the form of pixels in the spatial domain into an image in the transform domain, and expressing it in the form of transform coefficients. Since most images contain more flat areas and slowly changing areas, an appropriate transformation process can transform the scattered distribution of image energy in the spatial domain into a relatively concentrated distribution in the transformed domain, thereby eliminating signal differences. The frequency domain correlation among them, together with the quantization process, can effectively compress the code stream.
示例性的,熵编码是指按照信息熵的原理进行无损编码的方式,处于视频压缩的最后一个处理模块,用于将一系列用来表示视频序列的元素符号,转变为一个用来传输或存储的二进制码流,输入的符号可能包括量化后的变换系数,运动矢量信息,预测模式信息,变换量化相关语法等,熵编码模块的输出数据即原始视频压缩后的最终码流。熵编码可以有效地去除这些视频元素符号的统计冗余,是保证视频编码压缩效率的重要工具之一。Exemplarily, entropy coding refers to the way of lossless coding according to the principle of information entropy, which is the last processing module of video compression, and is used to convert a series of element symbols used to represent video sequences into a code for transmission or storage The input symbols may include quantized transform coefficients, motion vector information, prediction mode information, transform and quantization related syntax, etc. The output data of the entropy coding module is the final code stream after the original video compression. Entropy coding can effectively remove the statistical redundancy of these video element symbols, and is one of the important tools to ensure the compression efficiency of video coding.
二次变换:在相关技术中,针对4*4块和非4*4块使用不同的二次变换矩阵。从编码端来说,就是经过(DCT2,DCT2)变换后得到变换系数,然后对左上角的4*4的变换系数,再与二次变换矩阵相乘得到新的变换系数,然后再进行量化和熵编码。从解码端来说,对于从码流熵解码得到的变换系数经过反量化后,对于左上角的4*4区域先进行二次逆变换,得到新的变换系数,然后对整个变换块使用(DCT2,DCT2)进行逆变换,得到残差系数。Secondary transformation: In the related art, different secondary transformation matrices are used for 4*4 blocks and non-4*4 blocks. From the encoding side, the transformation coefficient is obtained after (DCT2, DCT2) transformation, and then the 4*4 transformation coefficient in the upper left corner is multiplied by the secondary transformation matrix to obtain a new transformation coefficient, and then quantized and Entropy coding. From the perspective of the decoder, after inverse quantization of the transformation coefficients obtained from entropy decoding of the code stream, a second inverse transformation is performed on the 4*4 area in the upper left corner to obtain new transformation coefficients, and then the entire transformation block is used (DCT2 , DCT2) for inverse transformation to obtain residual coefficients.
可选择的二次变换(AST,alternative secondary transform):对于帧内预测块来说,经过初始变换后得到的变换系数,可以选择做二次变换也可以选择不做二次变换,二次变换的目的是对低频区域进行第二次变换,是能量进一步集中。然而若当前块能量已经足够集中,则不需要进行二次变换,因此基于实际编码块,可以通过RDO来决定是否进行二次变换,可以基于显式或隐式的方式来表达当前块是否进行二次变换。若使用显式的AST,则通过码流显式编码二次变换指示信息,若使用隐式AST,则通过调整变换系数使满足预设奇偶性特征。Alternative secondary transform (AST, alternative secondary transform): For the intra-frame prediction block, the transformation coefficient obtained after the initial transformation can be selected to perform secondary transformation or not to perform secondary transformation, and the secondary transformation The purpose is to perform a second transformation on the low-frequency region, which further concentrates the energy. However, if the energy of the current block is concentrated enough, there is no need for secondary transformation. Therefore, based on the actual coding block, RDO can be used to determine whether to perform secondary transformation, and it can be expressed in an explicit or implicit way whether to perform secondary transformation transform. If the explicit AST is used, the secondary transformation indication information is explicitly encoded through the code stream, and if the implicit AST is used, the transformation coefficients are adjusted to meet the preset parity characteristics.
在相关技术中,默认亮度帧内预测残差块需要进行二次变换,但进行初始变换后,若初始变换后的变换系数的能量已经足够集中,再对初始变换后的变换系数进行二次变换,可能会出现过拟合现象,导致编码性能比较差等问题,即,二次变换的编码效果并不理想。In related technologies, by default, the luma intra prediction residual block needs to be transformed twice, but after the initial transformation, if the energy of the transformation coefficient after the initial transformation is concentrated enough, then the transformation coefficient after the initial transformation is transformed twice , there may be over-fitting phenomenon, leading to problems such as poor coding performance, that is, the coding effect of the secondary transformation is not ideal.
针对上述发现,本申请实施例中,编码端可以根据第一预设条件和第二预设条件判断是否允许对当前块进行二次变换,若当前块满足第一预设条件,且当前块也满足第二预设条件,则允许对当前块进行二次变换,基于此,可以根据当前块对应的率失真代价值确定是否对当前块进行二次变换。若当前块不满足第一预设条件,则禁止对当前块进行二次变换,从而剔除不需要进行二次变换的块,起到去冗余的作用,提高编码性能。若当前块满足第一预设条件,且当前块不满足第二预设条件,则直接确定对当前块进行二次变换。In view of the above findings, in the embodiment of the present application, the encoding end can judge whether to allow the second transformation of the current block according to the first preset condition and the second preset condition, if the current block satisfies the first preset condition, and the current block also If the second preset condition is met, the current block is allowed to undergo secondary transformation. Based on this, it may be determined whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. If the current block does not meet the first preset condition, it is prohibited to perform secondary transformation on the current block, so as to eliminate blocks that do not need to undergo secondary transformation, play a role in removing redundancy, and improve coding performance. If the current block satisfies the first preset condition and the current block does not satisfy the second preset condition, it is directly determined to perform secondary transformation on the current block.
在一种可能的实施方式中,针对编码端来说,可以通过RDO来确定是否对当前块进行二次变换,并显式编码指示信息(如secTuflag)来表示是否对当前块进行二次变换,例如,当secTuflag的取值为第一取值时,可以表示对当前块进行二次变换,当secTuflag的取值为第二取值时,可以表示对当前块不进行二次变换。针对解码端来说,在获取到编码比特流后,可以从编码比特流中解析出当前块的secTuflag,若secTuflag的取值为第一取值,则确定对当前块进行二次逆变换,若secTuflag的取值为第二取值,则确定对当前块不进行二次逆变换。In a possible implementation manner, for the encoding end, RDO can be used to determine whether to perform secondary transformation on the current block, and explicitly encode indication information (such as secTuflag) to indicate whether to perform secondary transformation on the current block, For example, when the value of secTuflag is the first value, it may indicate that a second transformation is performed on the current block; when the value of secTuflag is the second value, it may indicate that the current block is not to be transformed twice. For the decoding end, after obtaining the coded bit stream, the secTuflag of the current block can be parsed from the coded bit stream. If the value of secTuflag is the first value, it is determined to perform a second inverse transform on the current block. If If the value of secTuflag is the second value, it is determined not to perform the second inverse transform on the current block.
在另一种可能的实施方式中,针对编码端来说,可以通过RDO来确定是否对当前块进行二次变换,并通过目标变换系数矩阵的目标特征(如奇偶性等)来隐式表示是否对当前块进行二次变换,而不是通过指示信息来显式表示是否对当前块进行二次变换,比如说,通过目标变换系数矩阵的奇数变换系数的个数的奇偶性,来隐式表达secTuflag,决定当前块是否使用二次变换。针对解码端来说,在获取到编码比特流后,从编码比特流中解析出目标变换系数矩阵,并根据目标变换系数矩阵的目标特征确定当前块的预设标志位的目标取值,即推导出当前块的预设标志位的目标取值。若预设标志位的目标取值为第一取值,则确定对当前块进行二次逆变换。若预设标志位的目标取值为第二取值,则确定对当前块不进行二次逆变换。In another possible implementation, for the encoding end, RDO can be used to determine whether to perform secondary transformation on the current block, and the target characteristics (such as parity, etc.) of the target transformation coefficient matrix can be used to implicitly indicate whether Perform secondary transformation on the current block, instead of explicitly indicating whether to perform secondary transformation on the current block through indication information, for example, implicitly express secTuflag through the parity of the number of odd transformation coefficients in the target transformation coefficient matrix , to determine whether the current block uses secondary transformation. For the decoder, after obtaining the encoded bit stream, the target transform coefficient matrix is parsed from the encoded bit stream, and the target value of the preset flag bit of the current block is determined according to the target characteristics of the target transform coefficient matrix, that is, the derivation Output the target value of the preset flag bit of the current block. If the target value of the preset flag bit is the first value, it is determined to perform a second inverse transform on the current block. If the target value of the preset flag bit is the second value, it is determined not to perform the second inverse transform on the current block.
示例性的,基于上述两种情况,针对编码端来说,若确定需要对当前块进行二次变换,还可以基于尺寸限制条件,决定对左上角4*4的区域进行二次变换,还是8*8区域进行二次变换。针对解码端来说,若确定需要对当前块进行二次逆变换,还可以基于尺寸限制条件,决定对左上角4*4的区域进行二次逆变换,还是8*8区域进行二次逆变换。Exemplarily, based on the above two situations, for the encoding side, if it is determined that the current block needs to be re-transformed, it can also decide to perform a re-transform on the 4*4 area in the upper left corner based on the size constraint condition, or 8 *8 area undergoes secondary transformation. For the decoder, if it is determined that a second inverse transformation is required for the current block, it can also decide whether to perform a second inverse transformation on the 4*4 area in the upper left corner or an 8*8 area based on the size constraints .
以下结合几个具体实施例,对本申请实施例的编码方法、解码方法进行详细说明。The encoding method and the decoding method in the embodiment of the present application will be described in detail below in conjunction with several specific embodiments.
实施例1:参见图2A所示,为编码方法的流程示意图,可以应用于编码端,该方法包括:Embodiment 1: Referring to FIG. 2A, it is a schematic flow diagram of an encoding method, which can be applied to the encoding end. The method includes:
步骤211,获取当前块对应的残差系数矩阵。
步骤212,对该残差系数矩阵进行初始变换,得到初始变换系数矩阵。
步骤213,若当前块支持二次变换,当前块支持AST技术,且当前块满足第一预设条件,则确定当前块是否满足第二预设条件;若当前块满足第二预设条件,则根据当前块对应的率失真代价值,确定是否对当前块进行二次变换。
示例性的,第一预设条件包括当前块的预测模式为帧内预测模式。第二预设条件包括:当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。Exemplarily, the first preset condition includes that the prediction mode of the current block is an intra prediction mode. The second preset condition includes: the current block uses the intra-frame prediction filtering mode, or does not use the intra-frame prediction filtering mode.
在一种可能的实施方式中,第一预设条件可以包括如下条件的至少一个:当前块为亮度块;当前块的初始变换系数矩阵中含有非零变换系数。In a possible implementation manner, the first preset condition may include at least one of the following conditions: the current block is a luma block; and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
在一种可能的实施方式中,第一预设条件还可以包括:当前块采用的帧内预测模式的模式号位于第一模式号区间,且当前块外部左边的参考样本可用;或者,当前块采用的帧内预测模式的模式号位于第二模式号区间,且当前块外部上边的参考样本可用。In a possible implementation manner, the first preset condition may also include: the mode number of the intra prediction mode adopted by the current block is in the first mode number range, and the reference samples on the left outside the current block are available; or, the current block The mode number of the adopted intra-frame prediction mode is located in the second mode number interval, and the reference samples on the outside of the current block are available.
示例性的,第一模式号区间可以包括但不限于:模式号0~模式号2,模式号13~模式号32,模式号44~模式号65。第二模式号区间可以包括但不限于:模式号0~模式号23,模式号34~模式号57。当然,上述只是第一模式号区间和第二模式号区间的示例,对此不做限制。Exemplarily, the first range of mode numbers may include but not limited to:
在一种可能的实施方式中,第一预设条件还可以包括:当前块采用变换核对(DCT2,DCT2)进行初始变换;或者,当前块未采用变换核对(DST7,DST7)进行初始变换。In a possible implementation manner, the first preset condition may further include: the current block adopts the transformation checker (DCT2, DCT2) for initial transformation; or, the current block does not use the transformation kernel (DST7, DST7) for initial transformation.
示例性的,在IST技术中,参见表2所示,若istTuflag等于第一取值(如0),表示当前块使用变换核对(DCT2,DCT2)进行初始变换,若istTuflag等于第二取值(如1),表示当前块使用变换核对(DST7,DST7)进行初始变换。基于此,第一预设条件还可以包括:istTuflag=0,即通过istTuflag=0表示前块采用变换核对(DCT2,DCT2)进行初始变换。Exemplarily, in the IST technology, see Table 2, if istTuflag is equal to the first value (such as 0), it means that the current block uses the transformation check (DCT2, DCT2) for initial transformation, if istTuflag is equal to the second value ( As in 1), it means that the current block uses the transformation checker (DST7, DST7) for initial transformation. Based on this, the first preset condition may further include: istTuflag=0, that is, istTuflag=0 indicates that the previous block uses the transform check (DCT2, DCT2) for initial transformation.
在一种可能的实施方式中,第二预设条件还可以包括如下条件的一个:In a possible implementation manner, the second preset condition may also include one of the following conditions:
所述当前块的宽度和高度满足第一尺寸条件;或者,The width and height of the current block satisfy a first size condition; or,
所述当前块支持DT划分模式;或者,The current block supports DT division mode; or,
所述当前块不支持DT划分模式;或者,The current block does not support the DT division mode; or,
所述当前块的宽度和高度满足第一尺寸条件,且所述当前块支持DT划分模式;或者,The width and height of the current block meet the first size condition, and the current block supports the DT division mode; or,
所述当前块的宽度和高度满足第一尺寸条件,且所述当前块不支持DT划分模式。The width and height of the current block satisfy the first size condition, and the current block does not support the DT division mode.
示例性的,若当前块的宽度小于或等于第一数值,且当前块的高度小于或等于第二数值,则当前块的宽度和高度满足第一尺寸条件。例如,第一数值可以为32,第二数值可以为32,或者,第一数值可以为64,第二数值可以为64。当然,上述只是示例,对此不做限制。Exemplarily, if the width of the current block is less than or equal to the first value, and the height of the current block is less than or equal to the second value, then the width and height of the current block satisfy the first size condition. For example, the first value may be 32 and the second value may be 32, or the first value may be 64 and the second value may be 64. Of course, the above is just an example, without limitation.
示例性的,编码端根据当前块对应的率失真代价值,确定是否对当前块进行二次变换之后,若对当前块进行二次变换,则对初始变换系数矩阵中位于左上角的指定区域的变换系数进行二次变换,得到目标变换系数矩阵;若对当前块不进行二次变换,则将初始变换系数矩阵确定为目标变换系数矩阵。根据目标变换系数矩阵进行编码,得到当前块的编码比特流。Exemplarily, after the encoding end determines whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block, if the current block is subjected to secondary transformation, the specified area in the upper left corner of the initial transformation coefficient matrix The transform coefficients are transformed twice to obtain the target transform coefficient matrix; if the current block is not transformed twice, the initial transform coefficient matrix is determined as the target transform coefficient matrix. Encoding is performed according to the target transform coefficient matrix to obtain an encoded bit stream of the current block.
在一种可能的实施方式中,编码端可以显式的编码指示信息,通过该指示信息来表示是否对当前块进行二次变换。基于此,编码端可以直接在编码比特流中编码该目标变换系数矩阵,在此基础上,若对当前块进行二次变换,则可以在编码比特流中添加第一指示信息,第一指示信息用于指示对当前块进行二次变换。若对当前块不进行二次变换,则可以在编码比特流中添加第二指示信息,第二指示信息用于指示对当前块不进行二次变换。In a possible implementation manner, the encoding end may explicitly encode indication information, and the indication information indicates whether to perform secondary transformation on the current block. Based on this, the encoder can directly encode the target transformation coefficient matrix in the encoded bitstream. On this basis, if the current block is transformed twice, the first indication information can be added to the encoded bitstream. The first indication information It is used to indicate the secondary transformation of the current block. If secondary transformation is not performed on the current block, second indication information may be added to the coded bit stream, where the second indication information is used to indicate that secondary transformation is not performed on the current block.
在另一种可能的实施方式中,可以通过目标变换系数矩阵的目标特征(如奇偶性)来隐式表示是否对当前块进行二次变换,而不是通过指示信息来显式表示是否对当前块进行二次变换。基于此,根据目标变换系数矩阵进行编码,得到当前块的编码比特流,包括:根据目标变换系数矩阵中的变换系数,确定目标变换系数矩阵的目标特征;根据该目标特征和当前块的预设标志位的目标取值,确定是否对目标变换系数矩阵进行调整;预设标志位的目标取值为第一取值时,用于指示对当前块进行二次变换,预设标志位的目标取值为第二取值时,用于指示对当前块不进行二次变换。若不对目标变换系数矩阵进行调整,则对目标变换系数矩阵进行编码,得到当前块的编码比特流;若对目标变换系数矩阵进行调整,则对目标变换系数矩阵中的变换系数进行调整,以使调整后的目标变换系数矩阵的目标特征与预设标志位的目标取值相匹配,对调整后的目标变换系数矩阵进行编码,得到当前块的编码比特流。In another possible implementation manner, whether to perform secondary transformation on the current block may be implicitly indicated by the target feature (such as parity) of the target transformation coefficient matrix, instead of explicitly indicating whether to perform the second transformation on the current block through indication information Perform a secondary transformation. Based on this, encoding is performed according to the target transform coefficient matrix to obtain the encoded bit stream of the current block, including: determining the target feature of the target transform coefficient matrix according to the transform coefficients in the target transform coefficient matrix; according to the target feature and the preset of the current block The target value of the flag bit determines whether to adjust the target transformation coefficient matrix; when the target value of the preset flag bit is the first value, it is used to indicate the secondary transformation of the current block, and the target value of the preset flag bit When the value is the second value, it is used to indicate that no secondary transformation is performed on the current block. If the target transformation coefficient matrix is not adjusted, the target transformation coefficient matrix is encoded to obtain the encoded bit stream of the current block; if the target transformation coefficient matrix is adjusted, the transformation coefficients in the target transformation coefficient matrix are adjusted so that The target feature of the adjusted target transform coefficient matrix matches the target value of the preset flag bit, and the adjusted target transform coefficient matrix is encoded to obtain an encoded bit stream of the current block.
由以上技术方案可见,本申请实施例中,编码端可以根据第一预设条件和第二预设条件判断是否允许对当前块进行二次变换,若当前块满足第一预设条件,且当前块也满足第二预设条件,则允许对当前块进行二次变换,基于此,可以根据当前块对应的率失真代价值确定是否对当前块进行二次变换。若当前块不满足第一预设条件,则禁止对当前块进行二次变换,从而剔除不需要进行二次变换的块,起到去冗余的作用,提高编码性能。It can be seen from the above technical solutions that in the embodiment of the present application, the encoding end can judge whether to allow the second transformation of the current block according to the first preset condition and the second preset condition. If the current block satisfies the first preset condition, and the current If the block also satisfies the second preset condition, the current block is allowed to undergo secondary transformation. Based on this, it may be determined whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. If the current block does not meet the first preset condition, it is prohibited to perform secondary transformation on the current block, so as to eliminate blocks that do not need to undergo secondary transformation, play a role in removing redundancy, and improve coding performance.
实施例2:参见图2B所示,为解码方法的流程示意图,可以应用于解码端,该方法包括:Embodiment 2: Referring to FIG. 2B, it is a schematic flow diagram of a decoding method, which can be applied to a decoding end. The method includes:
步骤221,获取当前块的编码比特流。
步骤222,若当前块支持二次变换,当前块支持AST技术,且当前块满足第三预设条件,则确定当前块是否满足第四预设条件;若当前块满足第四预设条件,则根据该编码比特流中的指示信息或者目标变换系数矩阵确定是否对当前块进行二次逆变换。
第三预设条件可以包括当前块的预测模式为帧内预测模式;第四预设条件可以包括:当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。The third preset condition may include that the prediction mode of the current block is an intra-frame prediction mode; the fourth preset condition may include: the current block uses an intra-frame prediction filtering mode, or does not use an intra-frame prediction filtering mode.
在一种可能的实施方式中,第三预设条件可以包括如下条件的至少一个:当前块为亮度块;当前块的初始变换系数矩阵中含有非零变换系数。In a possible implementation manner, the third preset condition may include at least one of the following conditions: the current block is a luma block; and the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
在一种可能的实施方式中,第三预设条件还可以包括:当前块采用的帧内预测模式的模式号位于第一模式号区间,且当前块外部左边的参考样本可用;或者,当前块采用的帧内预测模式的模式号位于第二模式号区间,且当前块外部上边的参考样本可用。In a possible implementation manner, the third preset condition may also include: the mode number of the intra prediction mode adopted by the current block is in the first mode number interval, and the reference samples on the left outside the current block are available; or, the current block The mode number of the adopted intra-frame prediction mode is located in the second mode number interval, and the reference samples on the outside of the current block are available.
示例性的,第一模式号区间可以包括但不限于:模式号0~模式号2,模式号13~模式号32,模式号44~模式号65。第二模式号区间可以包括但不限于:模式号0~模式号23,模式号34~模式号57。当然,上述只是第一模式号区间和第二模式号区间的示例,对此不做限制。Exemplarily, the first range of mode numbers may include but not limited to:
在一种可能的实施方式中,第三预设条件还可以包括:当前块采用变换核对(DCT2,DCT2)进行初始逆变换;或者,当前块未采用变换核对(DST7,DST7)进行初始逆变换。In a possible implementation manner, the third preset condition may also include: the current block uses the transform check (DCT2, DCT2) to perform initial inverse transform; or, the current block does not use the transform check (DST7, DST7) to perform initial inverse transform .
示例性的,在IST技术中,若istTuflag等于第一取值(如0),表示当前块使用变换核对(DCT2,DCT2)进行初始逆变换,若istTuflag等于第二取值(如1),表示当前块使用变换核对(DST7,DST7)进行初始逆变换。基于此,第三预设条件还可以包括:istTuflag=0,即通过istTuflag=0表示前块采用变换核对(DCT2,DCT2)进行初始逆变换。Exemplarily, in the IST technology, if istTuflag is equal to the first value (such as 0), it means that the current block uses the transformation check (DCT2, DCT2) to perform initial inverse transformation; if istTuflag is equal to the second value (such as 1), it means The current block is initially inverse transformed using transform checks (DST7, DST7). Based on this, the third preset condition may further include: istTuflag=0, that is, istTuflag=0 indicates that the previous block uses the transform check (DCT2, DCT2) to perform initial inverse transform.
在一种可能的实施方式中,第四预设条件还可以包括如下条件的一个:In a possible implementation manner, the fourth preset condition may also include one of the following conditions:
所述当前块的宽度和高度满足第一尺寸条件;或者,The width and height of the current block satisfy a first size condition; or,
所述当前块支持DT划分模式;或者,The current block supports DT division mode; or,
所述当前块不支持DT划分模式;或者,The current block does not support the DT division mode; or,
所述当前块的宽度和高度满足第一尺寸条件,且所述当前块支持DT划分模式;或者,The width and height of the current block meet the first size condition, and the current block supports the DT division mode; or,
所述当前块的宽度和高度满足第一尺寸条件,且所述当前块不支持DT划分模式。The width and height of the current block satisfy the first size condition, and the current block does not support the DT division mode.
示例性的,若当前块的宽度小于或等于第一数值,且当前块的高度小于或等于第二数值,则当前块的宽度和高度满足第一尺寸条件。例如,第一数值可以为32,第二数值可以为32,或者,第一数值可以为64,第二数值可以为64。当然,上述只是示例,对此不做限制。Exemplarily, if the width of the current block is less than or equal to the first value, and the height of the current block is less than or equal to the second value, then the width and height of the current block satisfy the first size condition. For example, the first value may be 32 and the second value may be 32, or the first value may be 64 and the second value may be 64. Of course, the above is just an example, without limitation.
在一种可能的实施方式中,编码端可以显式的编码指示信息来表示是否对当前块进行二次变换。基于此,解码端根据该编码比特流中的指示信息确定是否对当前块进行二次逆变换,可以包括:从该编码比特流中解析出指示信息。若该指示信息为第一指示信息,则确定对当前块进行二次逆变换;第一指示信息用于指示对当前块进行二次变换;或者,若该指示信息为第二指示信息,则确定对当前块不进行二次逆变换;第二指示信息用于指示对当前块不进行二次变换。In a possible implementation manner, the encoding end may explicitly encode indication information to indicate whether to perform secondary transformation on the current block. Based on this, the decoding end determines whether to perform a second inverse transform on the current block according to the indication information in the coded bit stream, which may include: parsing out the indication information from the coded bit stream. If the indication information is the first indication information, determine to perform a second inverse transformation on the current block; the first indication information is used to indicate to perform a second transformation on the current block; or, if the indication information is the second indication information, determine No secondary inverse transformation is performed on the current block; the second indication information is used to indicate that no secondary transformation is performed on the current block.
在另一种可能的实施方式中,编码端可以通过目标变换系数矩阵的目标特征(如奇偶性)来隐式表示是否对当前块进行二次变换,而不是通过指示信息来显式表示。基于此,解码端根据该编码比特流中的目标变换系数矩阵确定是否对当前块进行二次逆变换,可以包括:从该编码比特流中解析出目标变换系数矩阵;根据目标变换系数矩阵中的变换系数,确定目标变换系数矩阵的目标特征。根据目标特征确定当前块的预设标志位的目标取值;预设标志位的目标取值为第一取值时,用于指示对当前块进行二次逆变换,预设标志位的目标取值为第二取值时,用于指示对当前块不进行二次逆变换。根据预设标志位的目标取值确定是否对当前块进行二次逆变换。In another possible implementation manner, the encoding end may implicitly indicate whether to perform secondary transformation on the current block through the target feature (such as parity) of the target transformation coefficient matrix, instead of explicitly indicating through indication information. Based on this, the decoder determines whether to perform a second inverse transform on the current block according to the target transform coefficient matrix in the coded bit stream, which may include: parsing out the target transform coefficient matrix from the coded bit stream; transform_coefficients, which identifies the target features for the target transform coefficient matrix. Determine the target value of the preset flag bit of the current block according to the target feature; when the target value of the preset flag bit is the first value, it is used to indicate that the current block is subjected to secondary inverse transformation, and the target value of the preset flag bit is When the value is the second value, it is used to indicate that the second inverse transformation is not performed on the current block. Whether to perform secondary inverse transformation on the current block is determined according to the target value of the preset flag bit.
示例性的,解码端根据编码比特流确定是否对当前块进行二次逆变换后,可以从编码比特流中解析出目标变换系数矩阵;若对当前块进行二次逆变换,则对目标变换系数矩阵中位于左上角的指定区域的变换系数进行二次逆变换,得到初始变换系数矩阵;若对当前块不进行二次逆变换,则将目标变换系数矩阵确定为初始变换系数矩阵。对初始变换系数矩阵进行初始逆变换,得到当前块对应的残差系数矩阵,根据残差系数矩阵确定当前块的重建值。Exemplarily, after determining whether to perform a second inverse transformation on the current block according to the coded bit stream, the decoder can parse out the target transformation coefficient matrix from the coded bit stream; The transformation coefficients in the specified area in the upper left corner of the matrix are subjected to secondary inverse transformation to obtain the initial transformation coefficient matrix; if the current block is not subjected to secondary inverse transformation, the target transformation coefficient matrix is determined as the initial transformation coefficient matrix. The initial inverse transformation is performed on the initial transformation coefficient matrix to obtain the residual coefficient matrix corresponding to the current block, and the reconstruction value of the current block is determined according to the residual coefficient matrix.
由以上技术方案可见,本申请实施例中,解码端可以根据第三预设条件和第四预设条件判断是否允许对当前块进行二次逆变换,比如说,若当前块满足第三预设条件,且当前块也满足第四预设条件,则允许对当前块进行二次逆变换,并根据当前块的编码比特流确定是否对当前块进行二次逆变换。若当前块不满足第三预设条件,则禁止对当前块进行二次逆变换,即解码端直接确定出当前块不进行二次逆变换,从而剔除不需要进行二次变换的块,起到去冗余的作用,从而提高编码性能。It can be seen from the above technical solutions that in the embodiment of the present application, the decoding end can judge whether to allow the second inverse transformation of the current block according to the third preset condition and the fourth preset condition, for example, if the current block satisfies the third preset condition condition, and the current block also satisfies the fourth preset condition, then the current block is allowed to be subjected to secondary inverse transformation, and whether to perform secondary inverse transformation on the current block is determined according to the coded bit stream of the current block. If the current block does not meet the third preset condition, the second inverse transformation of the current block is prohibited, that is, the decoding end directly determines that the current block does not undergo the second inverse transformation, thereby eliminating the blocks that do not need to undergo the second transformation. The role of de-redundancy, thereby improving the coding performance.
实施例3:参见图3A所示,为编码方法的流程示意图,可以应用于编码端,该方法包括:Embodiment 3: Referring to FIG. 3A, it is a schematic flow diagram of an encoding method, which can be applied to the encoding end. The method includes:
步骤311,获取当前块对应的残差系数矩阵。
示例性的,可以确定当前块对应的参考块,针对当前块的每个像素点,从参考块中确定与该像素点对应的参考点,该像素点的像素值与该参考点的像素值之间的差值,就是该像素点对应的残差系数,当前块的所有像素点对应的残差系数就组成当前块对应的残差系数矩阵。Exemplarily, the reference block corresponding to the current block may be determined, and for each pixel point of the current block, the reference point corresponding to the pixel point is determined from the reference block, and the difference between the pixel value of the pixel point and the pixel value of the reference point The difference between them is the residual coefficient corresponding to the pixel, and the residual coefficients corresponding to all the pixels of the current block form the residual coefficient matrix corresponding to the current block.
步骤312,对该残差系数矩阵进行初始变换,得到初始变换系数矩阵。
示例性的,可以采用变换核对(DCT2,DCT2)对残差系数矩阵进行初始变换,得到初始变换系数矩阵,也可以采用变换核对(DST7,DST7)对残差系数矩阵进行初始变换,得到初始变换系数矩阵。示例性的,在采用变换核对(DCT2,DCT2)对残差系数矩阵进行初始变换时,初始变换过程可以参见公式(3)所示,矩阵A是DCT2(参见表1所示),矩阵B也是DCT2。在采用变换核对(DST7,DST7)对残差系数矩阵进行初始变换时,初始变换过程可以参见公式(3)所示,矩阵A是DST7(参见表1所示),矩阵B也是DST7。Exemplarily, the transformation check (DCT2, DCT2) can be used to perform initial transformation on the residual coefficient matrix to obtain the initial transformation coefficient matrix, and the transformation correction (DST7, DST7) can also be used to perform initial transformation on the residual coefficient matrix to obtain the initial transformation coefficient matrix. Exemplarily, when the transformation check (DCT2, DCT2) is used to perform initial transformation on the residual coefficient matrix, the initial transformation process can be shown in formula (3), matrix A is DCT2 (see Table 1), and matrix B is also DCT2. When the transformation check (DST7, DST7) is used to perform initial transformation on the residual coefficient matrix, the initial transformation process can be shown in formula (3), matrix A is DST7 (see Table 1), and matrix B is also DST7.
关于采用变换核对(DCT2,DCT2)对残差系数矩阵进行初始变换,还是采用变换核对(DST7,DST7)对残差系数矩阵进行初始变换,可以采用如下方式:sr_x表示残差系数矩阵中最右面的非零变换系数的横坐标,sr_y表示残差系数矩阵中最下面的非零变换系数的纵坐标,sr_x和sr_y可以确定残差系数矩阵中所有非零变换系数对应的区域,超出该范围的区域都为0。若sr_x大于等于16或sr_y大于等于16时,编码端采用变换核对(DCT2,DCT2)对残差系数矩阵进行初始变换。否则,编码端通过RDO来选择采用变换核对(DCT2,DCT2)还是变换核对(DST7,DST7)。例如,若变换核对(DCT2,DCT2)的率失真代价值小于变换核对(DST7,DST7)的率失真代价值,则采用变换核对(DCT2,DCT2)对残差系数矩阵进行初始变换;若变换核对(DCT2,DCT2)的率失真代价值大于变换核对(DST7,DST7)的率失真代价值,则采用变换核对(DST7,DST7)对残差系数矩阵进行初始变换。Regarding the use of transformation check (DCT2, DCT2) for the initial transformation of the residual coefficient matrix, or the use of transformation check (DST7, DST7) for the initial transformation of the residual coefficient matrix, the following methods can be used: sr_x represents the rightmost part of the residual coefficient matrix The abscissa of the non-zero transformation coefficient of , sr_y represents the ordinate of the bottom non-zero transformation coefficient in the residual coefficient matrix, sr_x and sr_y can determine the area corresponding to all non-zero transformation coefficients in the residual coefficient matrix, and the area beyond this range Areas are all 0. If sr_x is greater than or equal to 16 or sr_y is greater than or equal to 16, the encoding end uses the transform check (DCT2, DCT2) to initially transform the residual coefficient matrix. Otherwise, the encoding end chooses to use transform check (DCT2, DCT2) or transform check (DST7, DST7) through RDO. For example, if the rate-distortion cost value of the transform check (DCT2, DCT2) is smaller than the rate-distortion cost value of the transform check (DST7, DST7), then the residual coefficient matrix is initially transformed using the transform check (DCT2, DCT2); if the transform check The rate-distortion cost value of (DCT2, DCT2) is greater than the rate-distortion cost value of the transformation check (DST7, DST7), and the transformation check (DST7, DST7) is used to initially transform the residual coefficient matrix.
当然,上述只是对该残差系数矩阵进行初始变换,得到初始变换系数矩阵的示例,对此不做限制,只要能够对残差系数矩阵进行初始变换,得到初始变换系数矩阵即可。Of course, the above is only an example of performing initial transformation on the residual coefficient matrix to obtain the initial transformation coefficient matrix, and there is no limitation on this, as long as the initial transformation can be performed on the residual coefficient matrix to obtain the initial transformation coefficient matrix.
步骤313,若当前块支持二次变换,当前块支持AST技术,且当前块满足第一预设条件,则确定当前块是否满足第二预设条件;若当前块满足第二预设条件,则根据当前块对应的率失真代价值,确定是否对当前块进行二次变换。
示例性的,若二次变换启用标志(如SecondaryTransformEnableFlag)的值为预设数值(如1),则确定当前块支持二次变换。二次变换启用标志的值为预设数值时,表示序列级或帧级允许启用二次变换,即允许当前块启用二次变换,因此,编码端确定当前块支持二次变换。Exemplarily, if the value of the secondary transformation enabling flag (such as SecondaryTransformEnableFlag) is a preset value (such as 1), it is determined that the current block supports secondary transformation. When the value of the secondary transformation enable flag is a preset value, it means that the secondary transformation is allowed to be enabled at the sequence level or the frame level, that is, the current block is allowed to enable the secondary transformation. Therefore, the encoder determines that the current block supports the secondary transformation.
示例性的,若可选择的二次变换启用标志(如AstEnableFlag)的值为预设取值(如1),则确定当前块支持AST技术。可选择的二次变换启用标志为预设数值时,表示序列级或帧级允许启用AST技术,即允许当前块启用AST技术,因此,编码端确定当前块支持AST技术。Exemplarily, if the value of the optional secondary transform enabling flag (such as AstEnableFlag) is a preset value (such as 1), it is determined that the current block supports AST technology. When the optional secondary transform enabling flag is a preset value, it means that the sequence level or frame level allows enabling the AST technology, that is, allowing the current block to enable the AST technology, therefore, the encoder determines that the current block supports the AST technology.
示例性的,若当前块不支持二次变换,则编码端确定对当前块不进行二次变换。若当前块支持二次变换,但是,当前块未支持AST技术,则编码端确定对当前块不进行二次变换。Exemplarily, if the current block does not support secondary transformation, the encoder determines not to perform secondary transformation on the current block. If the current block supports the secondary transformation, but the current block does not support the AST technology, the encoder determines not to perform the secondary transformation on the current block.
若当前块支持二次变换,且当前块支持AST技术,则编码端判断当前块是否满足第一预设条件。若当前块不满足第一预设条件,则编码端确定对当前块不进行二次变换。If the current block supports secondary transformation, and the current block supports AST technology, the encoder determines whether the current block satisfies the first preset condition. If the current block does not meet the first preset condition, the encoder determines not to perform secondary transformation on the current block.
若当前块支持二次变换,且当前块支持AST技术,且当前块满足第一预设条件,则编码端确定当前块是否满足第二预设条件。若当前块不满足第二预设条件,则编码端直接确定对当前块进行二次变换,而不再采用RDO等方式决策是否进行二次变换。If the current block supports secondary transformation, and the current block supports AST technology, and the current block satisfies the first preset condition, then the encoder determines whether the current block satisfies the second preset condition. If the current block does not satisfy the second preset condition, the encoding end directly determines to perform the second transformation on the current block, instead of using RDO or other methods to decide whether to perform the second transformation.
若当前块支持二次变换,且当前块支持AST技术,且当前块满足第一预设条件,则编码端确定当前块是否满足第二预设条件。若当前块满足第二预设条件,则编码端根据当前块对应的率失真代价值,确定是否对当前块进行二次变换。例如,确定对当前块只进行初始变换时的第一率失真代价值,确定对当前块先进行初始变换再进行二次变换时的第二率失真代价值。若第二率失真代价值小于第一率失真代价值,则确定对当前块进行二次变换。若第二率失真代价值大于第一率失真代价值,则确定对当前块不进行二次变换。If the current block supports secondary transformation, and the current block supports AST technology, and the current block satisfies the first preset condition, then the encoder determines whether the current block satisfies the second preset condition. If the current block satisfies the second preset condition, the encoder determines whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. For example, a first rate-distortion cost value is determined when only initial transformation is performed on the current block, and a second rate-distortion cost value is determined when initial transformation is performed on the current block and then secondary transformation is performed. If the second rate-distortion cost is smaller than the first rate-distortion cost, it is determined to perform a second transform on the current block. If the second rate-distortion cost is greater than the first rate-distortion cost, it is determined not to perform secondary transformation on the current block.
在确定对当前块只进行初始变换时的第一率失真代价值时,编码端对残差系数矩阵进行初始变换,得到初始变换系数矩阵,基于初始变换系数矩阵确定当前块对应的第一率失真代价值,对此确定方式不做限制,可以采用RDO确定当前块对应的第一率失真代价值。When determining the first rate-distortion cost value when only the initial transformation is performed on the current block, the encoder performs initial transformation on the residual coefficient matrix to obtain the initial transformation coefficient matrix, and determines the first rate-distortion corresponding to the current block based on the initial transformation coefficient matrix The cost value is not limited to the determination method, and RDO may be used to determine the first rate-distortion cost value corresponding to the current block.
在确定对当前块先进行初始变换再进行二次变换时的第二率失真代价值时,编码端对残差系数矩阵进行初始变换,得到初始变换系数矩阵,并对初始变换系数矩阵进行二次变换,得到目标变换系数矩阵,基于目标变换系数矩阵确定当前块对应的第二率失真代价值,对此确定方式不做限制,可以采用RDO确定当前块对应的第二率失真代价值。When determining the second rate-distortion cost value when performing the initial transformation on the current block and then performing the secondary transformation, the encoding end performs the initial transformation on the residual coefficient matrix to obtain the initial transformation coefficient matrix, and performs a secondary transformation on the initial transformation coefficient matrix Transform to obtain the target transform coefficient matrix, and determine the second rate-distortion cost value corresponding to the current block based on the target transform coefficient matrix.
在上述实施例中,需要判断当前块是否满足第一预设条件,针对第一预设条件,在一种可能的实施方式中,第一预设条件可以包括但不限于以下条件中的至少一个:In the above embodiments, it is necessary to determine whether the current block satisfies the first preset condition. For the first preset condition, in a possible implementation manner, the first preset condition may include but not limited to at least one of the following conditions :
条件1:当前块的预测模式为帧内预测模式。Condition 1: the prediction mode of the current block is an intra prediction mode.
条件2:当前块为亮度块。Condition 2: the current block is a luma block.
条件3:当前块的初始变换系数矩阵中含有非零变换系数。Condition 3: The initial transform coefficient matrix of the current block contains non-zero transform coefficients.
当前块的初始变换系数矩阵中含有非零变换系数是指:在对残差系数矩阵进行初始变换,得到初始变换系数矩阵后,若初始变换系数矩阵中的所有变换系数均为零,则说明初始变换系数矩阵中不含有非零变换系数,在此情况下,当前块的cbf标志位置为第一数值(如数值0),不需要编码当前块的变换系数。若初始变换系数矩阵中的所有变换系数不均为零(即任意一个或多个变换系数不为零),则说明初始变换系数矩阵中含有非零变换系数,在此情况下,当前块的cbf标志位置为第二数值(如数值1),需要编码当前块的变换系数。The initial transformation coefficient matrix of the current block contains non-zero transformation coefficients, which means that after the initial transformation is performed on the residual coefficient matrix to obtain the initial transformation coefficient matrix, if all the transformation coefficients in the initial transformation coefficient matrix are zero, it means that the initial The transformation coefficient matrix does not contain non-zero transformation coefficients. In this case, the position of the cbf flag of the current block is the first value (such as the value 0), and the transformation coefficient of the current block does not need to be encoded. If all the transform coefficients in the initial transform coefficient matrix are not zero (that is, any one or more transform coefficients are not zero), it means that the initial transform coefficient matrix contains non-zero transform coefficients. In this case, the cbf of the current block The flag position is the second value (for example, value 1), which needs to encode the transform coefficient of the current block.
条件4:当前块采用的帧内预测模式的模式号位于第一模式号区间,且当前块外部左边的参考样本可用;或者,当前块采用的帧内预测模式的模式号位于第二模式号区间,且当前块外部上边的参考样本可用。示例性的,第一模式号区间可以包括模式号0~模式号2,模式号13~模式号32,模式号44~模式号65。第二模式号区间可以包括模式号0~模式号23,模式号34~模式号57。当然,上述只是第一模式号区间和第二模式号区间的示例,对此不做限制。Condition 4: The mode number of the intra prediction mode adopted by the current block is located in the first mode number interval, and the reference samples on the left outside the current block are available; or, the mode number of the intra prediction mode adopted by the current block is located in the second mode number interval , and the reference samples above and outside the current block are available. Exemplarily, the first mode number interval may include
条件5:当前块采用变换核对(DCT2,DCT2)进行初始变换;或者,当前块未采用变换核对(DST7,DST7)进行初始变换。或者,istTuflag等于第一取值(如0)。Condition 5: The current block uses the transform check (DCT2, DCT2) for initial transform; or, the current block does not use the transform check (DST7, DST7) for initial transform. Alternatively, istTuflag is equal to the first value (such as 0).
参见步骤312,编码端采用变换核对(DCT2,DCT2)对残差系数矩阵进行初始变换,或采用变换核对(DST7,DST7)对残差系数矩阵进行初始变换。Referring to step 312, the coding end uses the transform check (DCT2, DCT2) to perform an initial transform on the residual coefficient matrix, or uses the transform check (DST7, DST7) to perform an initial transform on the residual coefficient matrix.
若采用变换核对(DCT2,DCT2)对残差系数矩阵进行初始变换,则条件5满足,若采用变换核对(DST7,DST7)对残差系数矩阵进行初始变换,则条件5不满足。If the transformation check (DCT2, DCT2) is used to initially transform the residual coefficient matrix,
示例性的,第一预设条件可以只包括条件1和条件2。或者,第一预设条件可以只包括条件1,条件2和条件5。或者,第一预设条件可以包括条件1,条件2和条件5,在此基础上,第一预设条件还可以包括条件4和/或条件5,当然,上述只是示例,对此不做限制。Exemplarily, the first preset condition may only include
第一预设条件包括条件4时,第一预设条件只包括条件4的一种情况即可,例如,第一预设条件可以包括当前块采用的帧内预测模式的模式号位于第一模式号区间,且当前块外部左边的参考样本可用。或者,第一预设条件可以包括当前块采用的帧内预测模式的模式号位于第二模式号区间,且当前块外部上边的参考样本可用。When the first preset condition includes
第一预设条件包括条件5时,第一预设条件只包括条件5的一种情况即可,例如,第一预设条件可以包括当前块采用变换核对(DCT2,DCT2)进行初始变换。或者,第一预设条件可以包括当前块未采用变换核对(DST7,DST7)进行初始变换。When the first preset condition includes
以下结合几个具体应用场景,对第一预设条件的不同情况进行说明。The following describes different situations of the first preset condition in conjunction with several specific application scenarios.
应用场景1:第一预设条件可以包括:当前块的预测模式为帧内预测模式。Application scenario 1: the first preset condition may include: the prediction mode of the current block is an intra prediction mode.
应用场景2:第一预设条件可以包括:当前块的预测模式为帧内预测模式。当前块为亮度块。Application scenario 2: the first preset condition may include: the prediction mode of the current block is an intra prediction mode. The current block is a luma block.
应用场景3:第一预设条件可以包括:当前块的预测模式为帧内预测模式。当前块为亮度块。当前块采用变换核对(DCT2,DCT2)进行初始变换。Application scenario 3: the first preset condition may include: the prediction mode of the current block is an intra prediction mode. The current block is a luma block. The current block is initially transformed using transform checks (DCT2, DCT2).
应用场景4:第一预设条件可以包括:当前块的预测模式为帧内预测模式。当前块为亮度块。当前块未采用变换核对(DST7,DST7)进行初始变换。Application scenario 4: the first preset condition may include: the prediction mode of the current block is an intra prediction mode. The current block is a luma block. The current block was not initially transformed with transform checks (DST7, DST7).
应用场景5:在应用场景1-4中任一应用场景的基础上,第一预设条件还可以包括:当前块采用的帧内预测模式的模式号位于第一模式号区间,且当前块外部左边的参考样本可用。Application scenario 5: On the basis of any application scenario in application scenarios 1-4, the first preset condition may also include: the mode number of the intra prediction mode adopted by the current block is located in the first mode number interval, and the current block is outside The reference sample on the left is available.
应用场景6:在应用场景1-4中任一应用场景的基础上,第一预设条件还可以包括:当前块采用的帧内预测模式的模式号位于第二模式号区间,且当前块外部上边的参考样本可用。Application scenario 6: On the basis of any application scenario in application scenarios 1-4, the first preset condition may also include: the mode number of the intra prediction mode adopted by the current block is located in the second mode number interval, and the current block is outside The above reference samples are available.
应用场景7:在应用场景1-6中任一应用场景的基础上,第一预设条件还可以包括:当前块的初始变换系数矩阵中含有非零变换系数。Application scenario 7: On the basis of any application scenario in application scenarios 1-6, the first preset condition may further include: the initial transform coefficient matrix of the current block contains non-zero transform coefficients.
当然,上述应用场景1-应用场景7也只是第一预设条件的几个示例,对此第一预设条件不做限制。以应用场景3为例,当前块满足第一预设条件是指:若当前块的预测模式为帧内预测模式,当前块为亮度块,当前块采用变换核对(DCT2,DCT2)进行初始变换,则说明当前块满足第一预设条件。若当前块的预测模式不为帧内预测模式,则说明当前块不满足第一预设条件,或者,若当前块不为亮度块,则说明当前块不满足第一预设条件,或者,若当前块未采用变换核对(DCT2,DCT2)进行初始变换,则说明当前块不满足第一预设条件。Of course, the above application scenarios 1-7 are just a few examples of the first preset conditions, and there is no limitation on the first preset conditions. Taking
在上述实施例中,需要判断当前块是否满足第二预设条件,针对第二预设条件,在一种可能的实施方式中,第二预设条件可以包括但不限于以下条件中的至少一个:In the above embodiment, it is necessary to judge whether the current block satisfies the second preset condition. For the second preset condition, in a possible implementation manner, the second preset condition may include but not limited to at least one of the following conditions :
条件a:当前块使用帧内预测滤波模式,或者,当前块不使用帧内预测滤波模式。Condition a: the current block uses the intra prediction filtering mode, or the current block does not use the intra prediction filtering mode.
条件b:当前块支持DT划分模式;或者,当前块不支持DT划分模式。Condition b: the current block supports the DT division mode; or, the current block does not support the DT division mode.
条件c:当前块的宽度和高度满足第一尺寸条件。例如,若当前块的宽度小于或等于第一数值,且当前块的高度小于或等于第二数值,则当前块的宽度和高度满足第一尺寸条件。Condition c: the width and height of the current block satisfy the first size condition. For example, if the width of the current block is less than or equal to the first value, and the height of the current block is less than or equal to the second value, then the width and height of the current block satisfy the first size condition.
例如,第一数值可以为32或者64,第二数值可以为32或者64,当然,32和64只是示例,对此不做限制,如第一数值还可以为128,第二数值还可以为128等。比如说,第一数值为32,第二数值为32,或者,第一数值可以为64,第二数值可以为64。For example, the first numerical value can be 32 or 64, and the second numerical value can be 32 or 64. Of course, 32 and 64 are just examples, which are not limited. For example, the first numerical value can also be 128, and the second numerical value can also be 128. Wait. For example, the first numerical value is 32 and the second numerical value is 32, or the first numerical value may be 64 and the second numerical value may be 64.
示例性的,第二预设条件可以只包括条件a。或者,第二预设条件可以只包括条件a和条件b。或者,第二预设条件可以只包括条件a和条件c。或者,第二预设条件可以只包括条件b。或者,第二预设条件可以只包括条件b和条件c。或者,第二预设条件可以包括条件a,条件b和条件c。当然,上述只是示例,对此不做限制。Exemplarily, the second preset condition may only include condition a. Alternatively, the second preset condition may only include condition a and condition b. Alternatively, the second preset condition may only include condition a and condition c. Alternatively, the second preset condition may only include condition b. Alternatively, the second preset condition may only include condition b and condition c. Alternatively, the second preset condition may include condition a, condition b and condition c. Of course, the above is just an example, without limitation.
第二预设条件包括条件a时,只包括条件a的一种情况即可,例如,第二预设条件包括当前块使用帧内预测滤波模式。或者,第二预设条件包括当前块不使用帧内预测滤波模式。When the second preset condition includes condition a, it only needs to include one case of condition a. For example, the second preset condition includes that the current block uses an intra prediction filtering mode. Alternatively, the second preset condition includes that the current block does not use an intra prediction filtering mode.
第二预设条件包括条件b时,只包括条件b的一种情况即可,例如,第二预设条件包括当前块支持DT划分模式。或者,第二预设条件包括当前块不支持DT划分模式。When the second preset condition includes condition b, only one case of condition b may be included. For example, the second preset condition includes that the current block supports the DT division mode. Alternatively, the second preset condition includes that the current block does not support the DT division mode.
以下结合几个具体应用场景,对第二预设条件的不同情况进行说明。The following describes different situations of the second preset condition in conjunction with several specific application scenarios.
应用场景8:第二预设条件可以包括:当前块使用帧内预测滤波模式。Application scenario 8: the second preset condition may include: the current block uses an intra prediction filtering mode.
应用场景9:第二预设条件可以包括:当前块不使用帧内预测滤波模式。Application scenario 9: the second preset condition may include: the current block does not use the intra prediction filtering mode.
应用场景10:第二预设条件可以包括:当前块支持DT划分模式。Application Scenario 10: The second preset condition may include: the current block supports the DT division mode.
应用场景11:第二预设条件可以包括:当前块不支持DT划分模式。Application Scenario 11: The second preset condition may include: the current block does not support the DT division mode.
应用场景12:第二预设条件可以包括:当前块使用帧内预测滤波模式。当前块支持DT划分模式。Application scenario 12: the second preset condition may include: the current block uses an intra prediction filtering mode. The current block supports DT partition mode.
应用场景13:第二预设条件可以包括:当前块使用帧内预测滤波模式。当前块不支持DT划分模式。Application scenario 13: the second preset condition may include: the current block uses an intra prediction filtering mode. The current block does not support DT partition mode.
应用场景14:第二预设条件可以包括:当前块不使用帧内预测滤波模式。当前块支持DT划分模式。Application scenario 14: the second preset condition may include: the current block does not use the intra prediction filtering mode. The current block supports DT partition mode.
应用场景15:第二预设条件可以包括:当前块不使用帧内预测滤波模式。当前块不支持DT划分模式。Application scenario 15: the second preset condition may include: the current block does not use the intra prediction filtering mode. The current block does not support DT partition mode.
应用场景16:在应用场景8-15中任一应用场景的基础上,第二预设条件还可以包括:当前块的宽度和高度满足第一尺寸条件。Application scenario 16: On the basis of any application scenario in application scenarios 8-15, the second preset condition may further include: the width and height of the current block satisfy the first size condition.
当然,上述应用场景8-应用场景16也只是第二预设条件的几个示例,对此第二预设条件不做限制。以应用场景12为例,当前块满足第二预设条件是指:若当前块使用帧内预测滤波模式,且当前块支持DT划分模式,则说明当前块满足第二预设条件。若当前块不使用帧内预测滤波模式,则说明当前块不满足第二预设条件,或者,若当前块不支持DT划分模式,则说明当前块不满足第二预设条件。Of course, the above-mentioned application scenarios 8-16 are just a few examples of the second preset conditions, and there is no limitation on the second preset conditions. Taking
步骤314,若对当前块进行二次变换,则对初始变换系数矩阵中位于左上角的指定区域的变换系数进行二次变换,得到目标变换系数矩阵;若对当前块不进行二次变换,则将初始变换系数矩阵确定为目标变换系数矩阵。至此,可以得到当前块的目标变换系数矩阵。Step 314: If the current block is to be transformed twice, then the transform coefficients in the specified area in the upper left corner of the initial transform coefficient matrix are transformed twice to obtain the target transform coefficient matrix; if the current block is not transformed twice, then The initial transform coefficient matrix is determined as the target transform coefficient matrix. So far, the target transformation coefficient matrix of the current block can be obtained.
在一种可能的实施方式中,对初始变换系数矩阵中位于左上角的指定区域的变换系数进行二次变换,可以包括但不限于:若当前块的宽度和高度满足第二尺寸条件,则基于第一指定尺寸的二次变换矩阵,对初始变换系数矩阵中位于左上角的第一指定区域的变换系数进行二次变换。若当前块的宽度和高度不满足第二尺寸条件,则基于第二指定尺寸的二次变换矩阵,对初始变换系数矩阵中位于左上角的第二指定区域的变换系数进行二次变换。In a possible implementation manner, performing a second transformation on the transformation coefficients of the specified area located in the upper left corner in the initial transformation coefficient matrix may include but not limited to: if the width and height of the current block meet the second size condition, based on The secondary transformation matrix of the first specified size performs secondary transformation on the transformation coefficients of the first specified area located in the upper left corner of the initial transformation coefficient matrix. If the width and height of the current block do not meet the second size condition, perform secondary transformation on the transformation coefficients of the second specified area located in the upper left corner in the initial transformation coefficient matrix based on the secondary transformation matrix of the second specified size.
示例性的,第一指定区域的尺寸为第一指定尺寸,第二指定区域的尺寸为第二指定尺寸,第一指定尺寸大于第二指定尺寸。例如,第一指定尺寸为8*8;第二指定尺寸为4*4。当然,上述只是第一指定尺寸和第二指定尺寸的示例,对此第一指定尺寸和第二指定尺寸不做限制。Exemplarily, the size of the first specified area is the first specified size, the size of the second specified area is the second specified size, and the first specified size is larger than the second specified size. For example, the first specified size is 8*8; the second specified size is 4*4. Of course, the above are only examples of the first specified size and the second specified size, and there is no limitation to the first specified size and the second specified size.
当前块的宽度和高度满足第二尺寸条件,可以包括但不限于:当前块的宽度大于等于第三数值,当前块的高度大于等于第四数值;或者,当前块的宽度大于等于第五数值,当前块的高度大于第六数值;或者,当前块的宽度大于第七数值,当前块的高度大于等于第八数值。The width and height of the current block meet the second size condition, which may include but not limited to: the width of the current block is greater than or equal to the third value, the height of the current block is greater than or equal to the fourth value; or, the width of the current block is greater than or equal to the fifth value, The height of the current block is greater than the sixth value; or, the width of the current block is greater than the seventh value, and the height of the current block is greater than or equal to the eighth value.
示例性的,上述第三数值,第四数值,第五数值,第六数值,第七数值,第八数值均可以根据经验进行配置,对这些数值均不做限制。例如,第三数值可以为8,也可以为16,第四数值可以为8,也可以为16,第五数值可以为8,也可以为16,第六数值可以为8,也可以为16,第七数值可以为8,也可以为16,第八数值可以为8,也可以为16。Exemplarily, the above-mentioned third value, fourth value, fifth value, sixth value, seventh value, and eighth value can all be configured according to experience, and these values are not limited. For example, the third numerical value may be 8 or 16, the fourth numerical value may be 8 or 16, the fifth numerical value may be 8 or 16, and the sixth numerical value may be 8 or 16. The seventh numerical value may be 8 or 16, and the eighth numerical value may be 8 or 16.
综上所述,若当前块的宽度和高度满足第二尺寸条件(如当前块的宽度大于等于8,当前块的高度大于等于8),则基于尺寸为8*8的二次变换矩阵,对初始变换系数矩阵中位于左上角的第一指定区域(即尺寸为8*8的区域)的变换系数进行二次变换。若当前块的宽度和高度不满足第二尺寸条件,则基于尺寸为4*4的二次变换矩阵,对初始变换系数矩阵中位于左上角的第二指定区域(即尺寸为4*4的区域)的变换系数进行二次变换。In summary, if the width and height of the current block meet the second size condition (such as the width of the current block is greater than or equal to 8, and the height of the current block is greater than or equal to 8), then based on the secondary transformation matrix with a size of 8*8, the The transformation coefficients of the first specified area (ie, the area with a size of 8*8) located in the upper left corner in the initial transformation coefficient matrix are subjected to secondary transformation. If the width and height of the current block do not meet the second size condition, then based on the secondary transformation matrix with a size of 4*4, the second specified area located in the upper left corner of the initial transformation coefficient matrix (that is, the area with a size of 4*4) ) transformation coefficients for secondary transformation.
步骤315,根据目标变换系数矩阵进行编码,得到当前块的编码比特流。
步骤316,若对当前块进行二次变换,则在当前块的编码比特流中添加第一指示信息,第一指示信息用于指示对当前块进行二次变换。若对当前块不进行二次变换,则在当前块的编码比特流中添加第二指示信息,第二指示信息用于指示对当前块不进行二次变换。Step 316: If the current block is to be re-transformed, first indication information is added to the coded bit stream of the current block, and the first indication information is used to instruct the current block to be re-transformed. If the current block is not to be re-transformed, second indication information is added to the coded bit stream of the current block, and the second indication information is used to indicate that the current block is not to be re-transformed.
示例性的,编码端可以显式的编码指示信息,通过该指示信息来表示是否对当前块进行二次变换。基于此,编码端在得到目标变换系数矩阵后,可以直接在当前块的编码比特流中编码该目标变换系数矩阵,并在当前块的编码比特流中添加第一指示信息或第二指示信息。Exemplarily, the encoding end may explicitly encode indication information, and the indication information indicates whether to perform secondary transformation on the current block. Based on this, after obtaining the target transformation coefficient matrix, the encoder can directly encode the target transformation coefficient matrix in the coded bitstream of the current block, and add the first indication information or the second indication information in the coded bitstream of the current block.
示例性的,目标变换系数矩阵经过熵编码过程变成编码比特流传到解码端,在根据目标变换系数矩阵进行编码的过程中,若当前块使用(DST7,DST7)变换核进行初始变换,则经过变换量化后的目标变换系数矩阵需要满足:sr_x和sr_y小于16,并且目标变换系数矩阵中所有非零变换系数的个数为奇数,用于表示当前块使用(DST7,DST7)变换核进行初始变换。或者,若当前块使用(DCT2,DCT2)变换核进行初始变换,则经过变换量化后的目标变换系数矩阵需要满足:sr_x或sr_y大于等于16,或者,目标变换系数矩阵中所有非零变换系数的个数为偶数,用于表示当前块使用(DCT2,DCT2)变换核进行初始变换。Exemplarily, the target transformation coefficient matrix is transformed into coded bits and streamed to the decoder through the entropy coding process. In the process of encoding according to the target transformation coefficient matrix, if the current block uses the (DST7, DST7) transformation kernel for initial transformation, then after The target transformation coefficient matrix after transformation and quantization needs to meet: sr_x and sr_y are less than 16, and the number of all non-zero transformation coefficients in the target transformation coefficient matrix is an odd number, which is used to indicate that the current block uses (DST7, DST7) transformation kernel for initial transformation . Or, if the current block uses the (DCT2, DCT2) transform kernel for initial transformation, the target transform coefficient matrix after transformation and quantization needs to satisfy: sr_x or sr_y is greater than or equal to 16, or, all non-zero transform coefficients in the target transform coefficient matrix The number is an even number, which is used to indicate that the current block uses the (DCT2, DCT2) transform kernel for initial transformation.
示例性的,若当前块支持二次变换,当前块支持AST技术,当前块满足第一预设条件,当前块满足第二预设条件,根据当前块对应的率失真代价值确定是否对当前块进行二次变换后,在当前块的编码比特流中添加指示信息,例如,若对当前块进行二次变换,在编码比特流中添加第一指示信息,若对当前块不进行二次变换,在编码比特流中添加第二指示信息。Exemplarily, if the current block supports secondary transformation, the current block supports AST technology, the current block satisfies the first preset condition, and the current block satisfies the second preset condition, it is determined according to the rate-distortion cost value corresponding to the current block After performing secondary transformation, add indication information to the coded bitstream of the current block, for example, if the current block is subjected to secondary transformation, add the first indication information to the coded bitstream, if the current block is not subjected to secondary transformation, The second indication information is added to the coded bit stream.
若当前块不支持二次变换,则确定对当前块不进行二次变换,但是不需要在当前块的编码比特流中添加指示信息。或者,若当前块支持二次变换,当前块不支持AST技术,则确定对当前块不进行二次变换,但是不需要在当前块的编码比特流中添加指示信息。或者,若当前块支持二次变换,当前块支持AST技术,当前块不满足第一预设条件,则确定对当前块不进行二次变换,但是不需要在当前块的编码比特流中添加指示信息。或者,若当前块支持二次变换,当前块支持AST技术,当前块满足第一预设条件,当前块不满足第二预设条件,则确定对当前块进行二次变换,但是不需要在当前块的编码比特流中添加指示信息。If the current block does not support secondary transformation, it is determined that secondary transformation is not performed on the current block, but no indication information needs to be added to the coded bit stream of the current block. Alternatively, if the current block supports secondary transformation but the current block does not support AST technology, it is determined that secondary transformation is not performed on the current block, but no indication information needs to be added to the coded bit stream of the current block. Or, if the current block supports secondary transformation, the current block supports AST technology, and the current block does not meet the first preset condition, it is determined that the current block is not subjected to secondary transformation, but there is no need to add an indication to the coded bitstream of the current block information. Or, if the current block supports secondary transformation, the current block supports AST technology, the current block satisfies the first preset condition, and the current block does not meet the second preset condition, then it is determined to perform secondary transformation on the current block, but it is not necessary to Indication information is added to the coded bitstream of the block.
在上述情况中,不需要在当前块的编码比特流中添加指示信息,是指不需要添加用于指示当前块不进行二次变换或者当前块进行二次变换的指示信息。In the above case, it is not necessary to add indication information to the coded bit stream of the current block, which means that indication information for indicating that the current block does not undergo secondary transformation or that the current block undergoes secondary transformation does not need to be added.
由以上技术方案可见,本申请实施例中,编码端可以根据第一预设条件和第二预设条件判断是否允许对当前块进行二次变换,若当前块满足第一预设条件,且当前块也满足第二预设条件,则允许对当前块进行二次变换,基于此,可以根据当前块对应的率失真代价值确定是否对当前块进行二次变换。若当前块不满足第一预设条件,则禁止对当前块进行二次变换,从而剔除不需要进行二次变换的块,起到去冗余的作用,提高编码性能。It can be seen from the above technical solutions that in the embodiment of the present application, the encoding end can judge whether to allow the second transformation of the current block according to the first preset condition and the second preset condition. If the current block satisfies the first preset condition, and the current If the block also satisfies the second preset condition, the current block is allowed to undergo secondary transformation. Based on this, it may be determined whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. If the current block does not meet the first preset condition, it is prohibited to perform secondary transformation on the current block, so as to eliminate blocks that do not need to undergo secondary transformation, play a role in removing redundancy, and improve coding performance.
实施例4:参见图3B所示,为解码方法的流程示意图,可以应用于解码端,该方法包括:Embodiment 4: Referring to FIG. 3B, it is a schematic flow diagram of a decoding method, which can be applied to a decoding end. The method includes:
步骤321,获取当前块的编码比特流。
步骤322,若当前块支持二次变换,当前块支持AST技术,且当前块满足第三预设条件,则确定当前块是否满足第四预设条件;若当前块满足第四预设条件,则从该编码比特流中解析出指示信息,根据该指示信息确定是否对当前块进行二次逆变换。
示例性的,若二次变换启用标志(如SecondaryTransformEnableFlag)的值为预设数值(如1),则确定当前块支持二次变换。二次变换启用标志的值为预设数值时,表示序列级或帧级允许启用二次变换,即允许当前块启用二次变换,因此,解码端确定当前块支持二次变换。Exemplarily, if the value of the secondary transformation enabling flag (such as SecondaryTransformEnableFlag) is a preset value (such as 1), it is determined that the current block supports secondary transformation. When the value of the secondary transformation enable flag is a preset value, it means that the secondary transformation is allowed to be enabled at the sequence level or the frame level, that is, the current block is allowed to enable the secondary transformation. Therefore, the decoder determines that the current block supports the secondary transformation.
示例性的,若可选择的二次变换启用标志(如AstEnableFlag)的值为预设取值(如1),则确定当前块支持AST技术。可选择的二次变换启用标志为预设数值时,表示序列级或帧级允许启用AST技术,即允许当前块启用AST技术,因此,解码端确定当前块支持AST技术。Exemplarily, if the value of the optional secondary transform enabling flag (such as AstEnableFlag) is a preset value (such as 1), it is determined that the current block supports AST technology. When the optional secondary transform enabling flag is a preset value, it means that the sequence level or frame level allows enabling the AST technology, that is, allowing the current block to enable the AST technology, therefore, the decoder determines that the current block supports the AST technology.
示例性的,若当前块不支持二次变换,则解码端确定对当前块不进行二次逆变换。若当前块支持二次变换,但当前块未支持AST技术,则解码端确定对当前块不进行二次逆变换。Exemplarily, if the current block does not support secondary transformation, the decoder determines not to perform secondary inverse transformation on the current block. If the current block supports secondary transformation, but the current block does not support AST technology, the decoder determines not to perform secondary inverse transformation on the current block.
若当前块支持二次变换,且当前块支持AST技术,则解码端判断当前块是否满足第三预设条件。若当前块不满足第三预设条件,则解码端确定对当前块不进行二次逆变换。If the current block supports secondary transformation and the current block supports AST technology, the decoding end judges whether the current block satisfies the third preset condition. If the current block does not satisfy the third preset condition, the decoding end determines not to perform the second inverse transform on the current block.
若当前块支持二次变换,且当前块支持AST技术,且当前块满足第三预设条件,则解码端确定当前块是否满足第四预设条件。若当前块不满足第四预设条件,则确定对当前块进行二次逆变换,而不需要根据编码比特流中的指示信息,确定是否对当前块进行二次逆变换。If the current block supports secondary transformation, and the current block supports AST technology, and the current block satisfies the third preset condition, then the decoder determines whether the current block satisfies the fourth preset condition. If the current block does not satisfy the fourth preset condition, it is determined whether to perform the second inverse transformation on the current block, without determining whether to perform the second inverse transformation on the current block according to the indication information in the coded bit stream.
若当前块支持二次变换,且当前块支持AST技术,且当前块满足第三预设条件,则解码端确定当前块是否满足第四预设条件。若当前块满足第四预设条件,则解码端从该编码比特流中解析出指示信息,根据该指示信息确定是否对当前块进行二次逆变换。例如,编码端可以显式编码指示信息来表示是否对当前块进行二次变换。基于此,解码端从编码比特流中解析出指示信息。若该指示信息为第一指示信息,则确定对当前块进行二次逆变换;第一指示信息用于指示对当前块进行二次变换;或者,若该指示信息为第二指示信息,则确定对当前块不进行二次逆变换;第二指示信息用于指示对当前块不进行二次变换。If the current block supports secondary transformation, and the current block supports AST technology, and the current block satisfies the third preset condition, then the decoder determines whether the current block satisfies the fourth preset condition. If the current block satisfies the fourth preset condition, the decoding end parses the indication information from the encoded bit stream, and determines whether to perform secondary inverse transformation on the current block according to the indication information. For example, the encoder may explicitly encode indication information to indicate whether to perform secondary transformation on the current block. Based on this, the decoding end parses the indication information from the coded bit stream. If the indication information is the first indication information, determine to perform a second inverse transformation on the current block; the first indication information is used to indicate to perform a second transformation on the current block; or, if the indication information is the second indication information, determine No secondary inverse transformation is performed on the current block; the second indication information is used to indicate that no secondary transformation is performed on the current block.
在上述实施例中,解码端需要判断当前块是否满足第三预设条件,针对第三预设条件,在一种可能的实施方式中,第三预设条件可以包括但不限于以下条件中的至少一个:In the above embodiment, the decoder needs to judge whether the current block meets the third preset condition. For the third preset condition, in a possible implementation manner, the third preset condition may include but not limited to the following conditions at least one:
条件1:当前块的预测模式为帧内预测模式。Condition 1: the prediction mode of the current block is an intra prediction mode.
条件2:当前块为亮度块。Condition 2: the current block is a luma block.
条件3:当前块的初始变换系数矩阵中含有非零变换系数。Condition 3: The initial transform coefficient matrix of the current block contains non-zero transform coefficients.
示例性的,若初始变换系数矩阵中不含有非零变换系数,则当前块的cbf标志位为第一数值(如数值0),若初始变换系数矩阵中含有非零变换系数(即任意一个或多个变换系数不为零),则当前块的cbf标志位为第二数值(如数值1)。基于此,解码端可以从编码比特流中解析出cbf标志位,若cbf标志位为第一数值,则确定初始变换系数矩阵中不含有非零变换系数,即初始变换系数矩阵中的所有变换系数均为零。若cbf标志位为第二数值,则确定初始变换系数矩阵中含有非零变换系数,即初始变换系数矩阵中的所有变换系数不均为零。Exemplarily, if the initial transform coefficient matrix does not contain non-zero transform coefficients, the cbf flag of the current block is the first value (such as a value of 0), and if the initial transform coefficient matrix contains non-zero transform coefficients (that is, any one or multiple transform coefficients are not zero), then the cbf flag bit of the current block is the second value (such as value 1). Based on this, the decoder can parse out the cbf flag bit from the encoded bit stream. If the cbf flag bit is the first value, it is determined that the initial transform coefficient matrix does not contain non-zero transform coefficients, that is, all transform coefficients in the initial transform coefficient matrix are all zero. If the cbf flag bit is the second value, it is determined that the initial transform coefficient matrix contains non-zero transform coefficients, that is, all transform coefficients in the initial transform coefficient matrix are not zero.
条件4:当前块采用的帧内预测模式的模式号位于第一模式号区间,且当前块外部左边的参考样本可用;或者,当前块采用的帧内预测模式的模式号位于第二模式号区间,且当前块外部上边的参考样本可用。示例性的,第一模式号区间可以包括模式号0~模式号2,模式号13~模式号32,模式号44~模式号65。第二模式号区间可以包括模式号0~模式号23,模式号34~模式号57。当然,上述只是第一模式号区间和第二模式号区间的示例,对此不做限制。Condition 4: The mode number of the intra prediction mode adopted by the current block is located in the first mode number interval, and the reference samples on the left outside the current block are available; or, the mode number of the intra prediction mode adopted by the current block is located in the second mode number interval , and the reference samples above and outside the current block are available. Exemplarily, the first mode number interval may include
条件5:当前块采用变换核对(DCT2,DCT2)进行初始逆变换;或,当前块未采用变换核对(DST7,DST7)进行初始逆变换。或者,istTuflag等于第一取值(如0)。Condition 5: The current block uses the transform check (DCT2, DCT2) for initial inverse transform; or, the current block does not use the transform check (DST7, DST7) for initial inverse transform. Alternatively, istTuflag is equal to the first value (such as 0).
例如,若采用变换核对(DCT2,DCT2)进行初始逆变换,条件5满足,若采用变换核对(DST7,DST7)进行初始逆变换,条件5不满足。For example, if transform checks (DCT2, DCT2) are used for initial inverse transformation,
示例性的,解码端确定当前块采用变换核对(DCT2,DCT2)进行初始逆变换,还是采用变换核对(DST7,DST7)进行初始逆变换,可以采用如下方式:解码端从编码比特流中解析得到sr_x和sr_y,当sr_x大于等于16或sr_y大于等于16时,解码端可以直接判定当前块采用变换核对(DCT2,DCT2)进行初始逆变换。当sr_x小于16且sr_y小于16时,则解码端可以确定目标变换系数矩阵中所有非零变换系数的个数的奇偶性。若该奇偶性为奇数,则解码端可以确定当前块采用变换核对(DST7,DST7)进行初始逆变换,若该奇偶性为偶数,则解码端可以确定当前块采用变换核对(DCT2,DCT2)进行初始逆变换。Exemplarily, the decoding end determines whether the current block uses the transformation check (DCT2, DCT2) to perform the initial inverse transformation, or uses the transformation check (DST7, DST7) to perform the initial inverse transformation, the following method can be adopted: the decoding end parses the encoded bit stream to obtain sr_x and sr_y, when sr_x is greater than or equal to 16 or sr_y is greater than or equal to 16, the decoder can directly determine that the current block uses the transform check (DCT2, DCT2) for initial inverse transform. When sr_x is less than 16 and sr_y is less than 16, the decoding end can determine the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix. If the parity is odd, the decoder can determine that the current block uses transform check (DST7, DST7) for initial inverse transform; if the parity is even, the decoder can determine that the current block uses transform check (DCT2, DCT2) initial inverse transformation.
当然,上述方式只是示例,对此不做限制,只要能够确定出当前块采用变换核对(DCT2,DCT2)进行初始逆变换,还是采用变换核对(DST7,DST7)进行初始逆变换即可。Of course, the above method is just an example, without limitation, as long as it can be determined whether the current block uses the transform check (DCT2, DCT2) for the initial inverse transform or uses the transform check (DST7, DST7) for the initial inverse transform.
示例性的,第三预设条件可以只包括条件1和条件2。或者,第三预设条件可以只包括条件1,条件2和条件5。或者,第三预设条件可以包括条件1,条件2和条件5,在此基础上,第三预设条件还可以包括条件4和/或条件5,当然,上述只是示例,对此不做限制。Exemplarily, the third preset condition may only include
示例性的,第三预设条件与第一预设条件类似,在此不再重复赘述。Exemplarily, the third preset condition is similar to the first preset condition, which will not be repeated here.
在上述实施例中,需要判断当前块是否满足第四预设条件,针对第四预设条件,在一种可能的实施方式中,第四预设条件可以包括但不限于以下条件中的至少一个:In the above embodiments, it is necessary to determine whether the current block satisfies the fourth preset condition. For the fourth preset condition, in a possible implementation manner, the fourth preset condition may include but not limited to at least one of the following conditions :
条件a:当前块使用帧内预测滤波模式,或者,当前块不使用帧内预测滤波模式。Condition a: the current block uses the intra prediction filtering mode, or the current block does not use the intra prediction filtering mode.
条件b:当前块支持DT划分模式;或者,当前块不支持DT划分模式。Condition b: the current block supports the DT division mode; or, the current block does not support the DT division mode.
条件c:当前块的宽度和高度满足第一尺寸条件。例如,若当前块的宽度小于或等于第一数值,且当前块的高度小于或等于第二数值,则当前块的宽度和高度满足第一尺寸条件。Condition c: the width and height of the current block satisfy the first size condition. For example, if the width of the current block is less than or equal to the first value, and the height of the current block is less than or equal to the second value, then the width and height of the current block satisfy the first size condition.
例如,第一数值可以为32或者64,第二数值可以为32或者64,当然,32和64只是示例,对此不做限制,如第一数值还可以为128,第二数值还可以为128等。比如说,第一数值为32,第二数值为32,或者,第一数值可以为64,第二数值可以为64。For example, the first numerical value can be 32 or 64, and the second numerical value can be 32 or 64. Of course, 32 and 64 are just examples, which are not limited. For example, the first numerical value can also be 128, and the second numerical value can also be 128. Wait. For example, the first numerical value is 32 and the second numerical value is 32, or the first numerical value may be 64 and the second numerical value may be 64.
示例性的,第四预设条件可以只包括条件a。或者,第四预设条件可以只包括条件a和条件b。或者,第四预设条件可以只包括条件a和条件c。或者,第四预设条件可以只包括条件b。或者,第四预设条件可以只包括条件b和条件c。或者,第四预设条件可以包括条件a,条件b和条件c。当然,上述只是示例,对此不做限制。Exemplarily, the fourth preset condition may only include condition a. Alternatively, the fourth preset condition may only include condition a and condition b. Alternatively, the fourth preset condition may only include condition a and condition c. Alternatively, the fourth preset condition may only include condition b. Alternatively, the fourth preset condition may only include condition b and condition c. Alternatively, the fourth preset condition may include condition a, condition b and condition c. Of course, the above is just an example, without limitation.
示例性的,第四预设条件与第二预设条件类似,在此不再重复赘述。Exemplarily, the fourth preset condition is similar to the second preset condition, which will not be repeated here.
步骤323,从编码比特流中解析出当前块的目标变换系数矩阵。
步骤324,若对当前块进行二次逆变换,则对目标变换系数矩阵中位于左上角的指定区域的变换系数进行二次逆变换,得到初始变换系数矩阵。若对当前块不进行二次逆变换,则将目标变换系数矩阵确定为初始变换系数矩阵。至此,得到当前块的初始变换系数矩阵。Step 324: If the current block is subjected to the second inverse transformation, perform the second inverse transformation on the transformation coefficients in the specified area in the upper left corner of the target transformation coefficient matrix to obtain the initial transformation coefficient matrix. If no secondary inverse transform is performed on the current block, the target transform coefficient matrix is determined as the initial transform coefficient matrix. So far, the initial transformation coefficient matrix of the current block is obtained.
示例性的,对目标变换系数矩阵中位于左上角的指定区域的变换系数进行二次逆变换,可以包括但不限于:若当前块的宽度和高度满足第二尺寸条件,则可以基于第一指定尺寸的二次逆变换矩阵(二次逆变换矩阵与编码端进行二次变换时采用的二次变换矩阵,可以为同一个),对目标变换系数矩阵中位于左上角的第一指定区域的变换系数进行二次逆变换。若当前块的宽度和高度不满足第二尺寸条件,则可以基于第二指定尺寸的二次逆变换矩阵,对目标变换系数矩阵中位于左上角的第二指定区域的变换系数进行二次逆变换。Exemplarily, performing a second inverse transform on the transform coefficients of the specified area in the upper left corner of the target transform coefficient matrix may include but not limited to: if the width and height of the current block meet the second size condition, then based on the first specified The size of the secondary inverse transformation matrix (the secondary inverse transformation matrix and the secondary transformation matrix used in the secondary transformation of the encoding end can be the same), the transformation of the first specified area in the upper left corner of the target transformation coefficient matrix Coefficients undergo a second inverse transformation. If the width and height of the current block do not meet the second size condition, the second inverse transform can be performed on the transform coefficients of the second specified area located in the upper left corner of the target transform coefficient matrix based on the second specified size of the second inverse transform matrix .
示例性的,第一指定区域的尺寸为第一指定尺寸,第二指定区域的尺寸为第二指定尺寸,第一指定尺寸大于第二指定尺寸。例如,第一指定尺寸为8*8;第二指定尺寸为4*4。当然,上述只是第一指定尺寸和第二指定尺寸的示例,对此第一指定尺寸和第二指定尺寸不做限制。Exemplarily, the size of the first specified area is the first specified size, the size of the second specified area is the second specified size, and the first specified size is larger than the second specified size. For example, the first specified size is 8*8; the second specified size is 4*4. Of course, the above are only examples of the first specified size and the second specified size, and there is no limitation to the first specified size and the second specified size.
当前块的宽度和高度满足第二尺寸条件,可以包括但不限于:当前块的宽度大于等于第三数值,当前块的高度大于等于第四数值;或者,当前块的宽度大于等于第五数值,当前块的高度大于第六数值;或者,当前块的宽度大于第七数值,当前块的高度大于等于第八数值。The width and height of the current block meet the second size condition, which may include but not limited to: the width of the current block is greater than or equal to the third value, the height of the current block is greater than or equal to the fourth value; or, the width of the current block is greater than or equal to the fifth value, The height of the current block is greater than the sixth value; or, the width of the current block is greater than the seventh value, and the height of the current block is greater than or equal to the eighth value.
示例性的,上述第三数值,第四数值,第五数值,第六数值,第七数值,第八数值均可以根据经验进行配置,对这些数值均不做限制。例如,第三数值可以为8,也可以为16,第四数值可以为8,也可以为16,第五数值可以为8,也可以为16,第六数值可以为8,也可以为16,第七数值可以为8,也可以为16,第八数值可以为8,也可以为16。Exemplarily, the above-mentioned third value, fourth value, fifth value, sixth value, seventh value, and eighth value can all be configured according to experience, and these values are not limited. For example, the third numerical value may be 8 or 16, the fourth numerical value may be 8 or 16, the fifth numerical value may be 8 or 16, and the sixth numerical value may be 8 or 16. The seventh numerical value may be 8 or 16, and the eighth numerical value may be 8 or 16.
综上所述,若当前块的宽度和高度满足第二尺寸条件(如当前块的宽度大于等于8,当前块的高度大于等于8),则基于尺寸为8*8的二次逆变换矩阵,对目标变换系数矩阵中位于左上角的第一指定区域(即尺寸为8*8的区域)的变换系数进行二次逆变换。若当前块的宽度和高度不满足第二尺寸条件,则基于尺寸为4*4的二次逆变换矩阵,对目标变换系数矩阵中位于左上角的第二指定区域(即尺寸为4*4的区域)的变换系数进行二次逆变换。In summary, if the width and height of the current block satisfy the second size condition (such as the width of the current block is greater than or equal to 8, and the height of the current block is greater than or equal to 8), then based on the secondary inverse transformation matrix with a size of 8*8, A second inverse transform is performed on the transform coefficients of the first designated area (ie, the area with a size of 8*8) located at the upper left corner in the target transform coefficient matrix. If the width and height of the current block do not satisfy the second size condition, then based on the quadratic inverse transform matrix with a size of 4*4, the second specified area located in the upper left corner in the target transform coefficient matrix (that is, the area with a size of 4*4 Area) transform coefficients are subjected to a second inverse transform.
步骤325,对初始变换系数矩阵进行初始逆变换,得到当前块对应的残差系数矩阵。Step 325: Perform an initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the current block.
示例性的,参见上述实施例中的条件8,解码端可以确定出当前块采用变换核对(DCT2,DCT2)进行初始逆变换,还是采用变换核对(DST7,DST7)进行初始逆变换,对此确定方式不再赘述。若采用变换核对(DCT2,DCT2)进行初始逆变换,则解码端可以采用变换核对(DCT2,DCT2)对初始变换系数矩阵进行初始逆变换,得到当前块对应的残差系数矩阵。或者,若采用变换核对(DST7,DST7)进行初始逆变换,则解码端可以采用变换核对(DST7,DST7)对初始变换系数矩阵进行初始逆变换,得到当前块对应的残差系数矩阵。Exemplarily, referring to condition 8 in the above-mentioned embodiment, the decoder can determine whether the current block uses the transform check (DCT2, DCT2) to perform the initial inverse transform, or uses the transform check (DST7, DST7) to perform the initial inverse transform. The method will not be repeated. If transform check (DCT2, DCT2) is used to perform initial inverse transform, the decoding end may use transform check (DCT2, DCT2) to perform initial inverse transform on the initial transform coefficient matrix to obtain the residual coefficient matrix corresponding to the current block. Alternatively, if the transformation check (DST7, DST7) is used to perform the initial inverse transformation, the decoding end may use the transformation check (DST7, DST7) to perform the initial inverse transformation on the initial transformation coefficient matrix to obtain the residual coefficient matrix corresponding to the current block.
步骤326,根据该残差系数矩阵确定当前块的重建值。
例如,可以确定当前块对应的参考块,针对当前块的每个像素点,从参考块中确定与该像素点对应的参考点,并从残差系数矩阵中确定该像素点对应的残差系数值。根据该参考点的像素值与该残差系数值,就可以得到该像素点的重建值。当前块的所有像素点对应的重建值,就可以组成当前块的重建值。当然,上述方式只是示例,对此不做限制。For example, the reference block corresponding to the current block may be determined, and for each pixel of the current block, the reference point corresponding to the pixel is determined from the reference block, and the residual coefficient corresponding to the pixel is determined from the residual coefficient matrix value. According to the pixel value of the reference point and the residual coefficient value, the reconstructed value of the pixel point can be obtained. The reconstruction values corresponding to all the pixels of the current block can form the reconstruction value of the current block. Of course, the above manner is only an example, and is not limited thereto.
综上所述,解码端可以根据目标变换系数矩阵中所有非零变换系数的个数的奇偶性,及sr_x和sr_y得到istTuflag。若istTuflag等于0,表示当前块使用变换核对(DCT2,DCT2)进行初始逆变换,若istTuflag等于1,表示当前块使用变换核对(DST7,DST7)进行初始逆变换。当istTuflag等于0,且需要对当前块进行二次逆变换,则解码端对目标变换系数矩阵进行二次逆变换,得到初始变换系数矩阵,然后再对初始变换系数矩阵进行初始逆变换,得到残差系数矩阵。当istTuflag等于0,且不需要对当前块进行二次逆变换,则解码端将目标变换系数矩阵确定为初始变换系数矩阵,对初始变换系数矩阵进行初始逆变换,得到残差系数矩阵。当istTuflag等于1时,解码端将目标变换系数矩阵确定为初始变换系数矩阵,对初始变换系数矩阵进行初始逆变换,得到残差系数矩阵。To sum up, the decoder can obtain istTuflag according to the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix, and sr_x and sr_y. If istTuflag is equal to 0, it means that the current block uses the transform check (DCT2, DCT2) for initial inverse transform; if istTuflag is equal to 1, it means that the current block uses the transform check (DST7, DST7) for initial inverse transform. When istTuflag is equal to 0 and needs to perform a second inverse transformation on the current block, the decoder performs a second inverse transformation on the target transformation coefficient matrix to obtain the initial transformation coefficient matrix, and then performs an initial inverse transformation on the initial transformation coefficient matrix to obtain the residual Difference coefficient matrix. When istTuflag is equal to 0 and there is no need to perform a second inverse transform on the current block, the decoder determines the target transform coefficient matrix as the initial transform coefficient matrix, performs initial inverse transform on the initial transform coefficient matrix, and obtains the residual coefficient matrix. When istTuflag is equal to 1, the decoding end determines the target transformation coefficient matrix as the initial transformation coefficient matrix, performs initial inverse transformation on the initial transformation coefficient matrix, and obtains the residual coefficient matrix.
然后,可以残差系数矩阵确定当前块的重建值,对此重建过程不再赘述。Then, the reconstruction value of the current block can be determined by the residual coefficient matrix, and the reconstruction process will not be repeated here.
由以上技术方案可见,本申请实施例中,解码端可以根据第三预设条件和第四预设条件判断是否允许对当前块进行二次逆变换,比如说,若当前块满足第三预设条件,且当前块也满足第四预设条件,则允许对当前块进行二次逆变换,并根据当前块的编码比特流确定是否对当前块进行二次逆变换。若当前块不满足第三预设条件,则禁止对当前块进行二次逆变换,即解码端直接确定出当前块不进行二次逆变换,从而剔除不需要进行二次变换的块,起到去冗余的作用,从而提高编码性能。It can be seen from the above technical solutions that in the embodiment of the present application, the decoding end can judge whether to allow the second inverse transformation of the current block according to the third preset condition and the fourth preset condition, for example, if the current block satisfies the third preset condition condition, and the current block also satisfies the fourth preset condition, then the current block is allowed to be subjected to secondary inverse transformation, and whether to perform secondary inverse transformation on the current block is determined according to the coded bit stream of the current block. If the current block does not meet the third preset condition, the second inverse transformation of the current block is prohibited, that is, the decoding end directly determines that the current block does not undergo the second inverse transformation, thereby eliminating the blocks that do not need to undergo the second transformation. The role of de-redundancy, thereby improving the coding performance.
实施例5:参见图4A所示,为编码方法的流程示意图,可以应用于编码端,该方法包括:Embodiment 5: Referring to FIG. 4A, it is a schematic flow diagram of an encoding method, which can be applied to the encoding end. The method includes:
步骤411,获取当前块对应的残差系数矩阵。
步骤412,对该残差系数矩阵进行初始变换,得到初始变换系数矩阵。Step 412: Perform an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix.
步骤413,若当前块支持二次变换,当前块支持AST技术,且当前块满足第一预设条件,则确定当前块是否满足第二预设条件;若当前块满足第二预设条件,则根据当前块对应的率失真代价值,确定是否对当前块进行二次变换。
步骤414,若对当前块进行二次变换,则对初始变换系数矩阵中位于左上角的指定区域的变换系数进行二次变换,得到目标变换系数矩阵;若对当前块不进行二次变换,则将初始变换系数矩阵确定为目标变换系数矩阵。至此,可以得到当前块的目标变换系数矩阵。Step 414: If the current block is to be transformed twice, then the transform coefficients in the specified area in the upper left corner of the initial transform coefficient matrix are transformed twice to obtain the target transform coefficient matrix; if the current block is not transformed twice, then The initial transform coefficient matrix is determined as the target transform coefficient matrix. So far, the target transformation coefficient matrix of the current block can be obtained.
示例性的,步骤411-步骤414可以参见步骤311-步骤314,在此不再赘述。For example, step 411-
步骤415,根据目标变换系数矩阵中的变换系数,确定目标变换系数矩阵的目标特征。Step 415: Determine the target feature of the target transform coefficient matrix according to the transform coefficients in the target transform coefficient matrix.
示例性的,目标特征可以为目标奇偶性,目标奇偶性可以包括但不限于:目标变换系数矩阵中的所有奇数变换系数的个数的奇偶性;例如,若目标变换系数矩阵中存在30个奇数变换系数,则所有奇数变换系数的个数的奇偶性为偶数,即目标奇偶性为偶数。或者,目标变换系数矩阵中的所有偶数变换系数的个数的奇偶性;例如,若目标变换系数矩阵中存在25个偶数变换系数,则所有偶数变换系数的个数的奇偶性为奇数,即目标奇偶性为奇数。或者,目标变换系数矩阵中的所有变换系数的绝对值之和的奇偶性;例如,对目标变换系数矩阵中的所有变换系数的绝对值求和,若求和结果为奇数,则目标奇偶性为奇数,若求和结果为偶数,则目标奇偶性为偶数。当然,上述目标奇偶性只是几个示例,对此不做限制,如目标奇偶性还可以为绝对值为1的系数的个数的奇偶性,最后一个非零变换系数的奇偶性等。Exemplarily, the target feature may be target parity, and the target parity may include but not limited to: the parity of the number of all odd transform coefficients in the target transform coefficient matrix; for example, if there are 30 odd transform coefficients in the target transform coefficient matrix transform coefficients, the parity of all odd transform coefficients is an even number, that is, the target parity is an even number. Or, the parity of the number of all even transform coefficients in the target transform coefficient matrix; for example, if there are 25 even transform coefficients in the target transform coefficient matrix, the parity of the number of all even transform coefficients is odd, that is, the target Parity is odd. Or, the parity of the sum of the absolute values of all the transform coefficients in the target transform coefficient matrix; for example, if the sum of the absolute values of all the transform coefficients in the target transform coefficient matrix is odd, then the target parity is Odd, if the sum result is even, then the target parity is even. Of course, the above target parity is just a few examples, which is not limited. For example, the target parity can also be the parity of the number of coefficients with an absolute value of 1, the parity of the last non-zero transformation coefficient, and so on.
目标特征还可以为目标正负性,目标正负性可以包括但不限于:目标变换系数矩阵中的最后一个非零变换系数的正负性;或者,目标变换系数矩阵中的第一个非零变换系数的正负性;或者,目标变换系数矩阵中的第N个非零变换系数的正负性,N的取值可以根据实际需要任意配置,对此不做限制。当然,上述目标正负性只是几个示例,对此目标正负性不做限制,如目标正负性可以为目标变换系数矩阵中的所有变换系数的绝对值之和的正负性等。The target feature can also be the sign of the target, and the sign of the target can include but not limited to: the sign of the last non-zero transform coefficient in the target transform coefficient matrix; or, the first non-zero transform coefficient in the target transform coefficient matrix The positive or negative of the transform coefficient; or, the positive or negative of the Nth non-zero transform coefficient in the target transform coefficient matrix, the value of N can be arbitrarily configured according to actual needs, and there is no limitation on this. Certainly, the above-mentioned target sign or negative are just a few examples, and there is no limitation on this target sign or negative, for example, the target sign or negative may be the sign or negative of the sum of the absolute values of all the transform coefficients in the target transform coefficient matrix.
当然,目标奇偶性和目标正负性只是目标特征的两个示例,对此目标特征不做限制。为了方便描述,后续以目标奇偶性为例进行说明,其它目标特征的处理方式类似。Of course, target parity and target positive/negative are just two examples of target features, and there is no limitation on the target features. For the convenience of description, target parity is used as an example for description in the following, and other target features are processed in a similar manner.
步骤416,根据目标特征和当前块的预设标志位的目标取值,确定是否对目标变换系数矩阵进行调整。示例性的,预设标志位的目标取值为第一取值时,用于指示对当前块进行二次变换,预设标志位的目标取值为第二取值时,用于指示对当前块不进行二次变换。Step 416: Determine whether to adjust the target transformation coefficient matrix according to the target feature and the target value of the preset flag bit of the current block. Exemplarily, when the target value of the preset flag bit is the first value, it is used to indicate that the current block is to be transformed twice, and when the target value of the preset flag bit is the second value, it is used to indicate that the current block is transformed Blocks are not retransformed.
示例性的,编码端根据当前块对应的率失真代价值,确定是否对当前块进行二次变换之后,若对当前块进行二次变换,则可以将预设标志位的目标取值设置为第一取值,以指示对当前块进行二次变换。若对当前块不进行二次变换,则可以将预设标志位的目标取值设置为第二取值,以指示对当前块不进行二次变换。例如,第一取值可以为1,第二取值可以为0;或者,第一取值可以为0,第二取值可以为1;当然,上述只是示例,对此不做限制。Exemplarily, after the encoding end determines whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block, if the current block is subjected to secondary transformation, the target value of the preset flag can be set to the first A value to indicate that the current block should be retransformed. If the second transformation is not performed on the current block, the target value of the preset flag bit may be set as the second value to indicate that the second transformation is not performed on the current block. For example, the first value may be 1, and the second value may be 0; or, the first value may be 0, and the second value may be 1; of course, the above is only an example, and is not limited thereto.
在一种可能的实施方式中,编码端和解码端可以约定目标奇偶性与二次变换的关系,例如,目标奇偶性为奇数时,表示对当前块进行二次变换,目标奇偶性为偶数时,表示对当前块不进行二次变换,即约定“奇数”与进行二次变换,“偶数”与不进行二次变换的关系。In a possible implementation manner, the encoding end and the decoding end can agree on the relationship between the target parity and the secondary transformation. For example, when the target parity is odd, it means performing secondary transformation on the current block, and when the target parity is even , indicating that the current block is not subjected to secondary transformation, that is, the relationship between "odd number" and secondary transformation, "even number" and no secondary transformation is agreed.
在上述情况下,若目标奇偶性为奇数,且当前块的预设标志位的目标取值为第一取值,则确定对目标变换系数矩阵不进行调整,示例性的,若目标奇偶性为奇数,则表示对当前块进行二次变换,预设标志位的目标取值为第一取值,也表示对当前块进行二次变换,因此,对目标变换系数矩阵不进行调整。或者,若目标奇偶性为奇数,且当前块的预设标志位的目标取值为第二取值,则确定对目标变换系数矩阵进行调整,示例性的,若目标奇偶性为奇数,则表示对当前块进行二次变换,预设标志位的目标取值为第二取值,表示对当前块不进行二次变换,因此,对目标变换系数矩阵进行调整。或者,若目标奇偶性为偶数,且当前块的预设标志位的目标取值为第一取值,则确定对目标变换系数矩阵进行调整,示例性的,若目标奇偶性为偶数,则表示对当前块不进行二次变换,预设标志位的目标取值为第一取值,表示对当前块进行二次变换,因此,对目标变换系数矩阵进行调整。或者,若目标奇偶性为偶数,且当前块的预设标志位的目标取值为第二取值,则确定对目标变换系数矩阵不进行调整,示例性的,若目标奇偶性为偶数,则表示对当前块不进行二次变换,预设标志位的目标取值为第二取值,表示对当前块不进行二次变换,因此,对目标变换系数矩阵不进行调整。In the above case, if the target parity is an odd number, and the target value of the preset flag bit of the current block is the first value, it is determined not to adjust the target transformation coefficient matrix. For example, if the target parity is An odd number means that the current block is to be transformed twice, and the target value of the preset flag bit is the first value, which also means that the current block is transformed twice, so the target transformation coefficient matrix is not adjusted. Or, if the target parity is an odd number, and the target value of the preset flag bit of the current block is the second value, it is determined to adjust the target transformation coefficient matrix. For example, if the target parity is an odd number, it means The second transformation is performed on the current block, and the target value of the preset flag bit is the second value, which means that the second transformation is not performed on the current block. Therefore, the target transformation coefficient matrix is adjusted. Or, if the target parity is an even number, and the target value of the preset flag bit of the current block is the first value, it is determined to adjust the target transform coefficient matrix. For example, if the target parity is an even number, it means The current block is not subjected to secondary transformation, and the target value of the preset flag bit is the first value, indicating that the current block is subjected to secondary transformation. Therefore, the target transformation coefficient matrix is adjusted. Or, if the target parity is an even number, and the target value of the preset flag bit of the current block is the second value, it is determined not to adjust the target transform coefficient matrix. For example, if the target parity is an even number, then Indicates that no secondary transformation is performed on the current block, and the target value of the preset flag bit is the second value, which indicates that secondary transformation is not performed on the current block, therefore, the target transformation coefficient matrix is not adjusted.
在另一种可能的实施方式中,编码端和解码端可以约定目标奇偶性与二次变换的关系,例如,目标奇偶性为偶数时,表示对当前块进行二次变换,目标奇偶性为奇数时,表示对当前块不进行二次变换,即约定“偶数”与进行二次变换,“奇数”与不进行二次变换的关系。In another possible implementation, the encoder and the decoder can agree on the relationship between the target parity and the secondary transformation. For example, when the target parity is an even number, it means that the current block is subjected to secondary transformation, and the target parity is an odd number. When , it means that the current block will not be transformed twice, that is, the relationship between "even number" and second transformation, and "odd number" and no second transformation will be agreed.
在上述情况下,若目标奇偶性为偶数,且当前块的预设标志位的目标取值为第一取值,则确定对目标变换系数矩阵不进行调整,示例性的,若目标奇偶性为偶数,则表示对当前块进行二次变换,预设标志位的目标取值为第一取值,也表示对当前块进行二次变换,因此,对目标变换系数矩阵不进行调整。或者,若目标奇偶性为偶数,且当前块的预设标志位的目标取值为第二取值,则确定对目标变换系数矩阵进行调整,示例性的,若目标奇偶性为偶数,则表示对当前块进行二次变换,预设标志位的目标取值为第二取值,表示对当前块不进行二次变换,因此,对目标变换系数矩阵进行调整。或者,若目标奇偶性为奇数,且当前块的预设标志位的目标取值为第一取值,则确定对目标变换系数矩阵进行调整,示例性的,若目标奇偶性为奇数,则表示对当前块不进行二次变换,预设标志位的目标取值为第一取值,表示对当前块进行二次变换,因此,对目标变换系数矩阵进行调整。或者,若目标奇偶性为奇数,且当前块的预设标志位的目标取值为第二取值,则确定对目标变换系数矩阵不进行调整,示例性的,若目标奇偶性为奇数,则表示对当前块不进行二次变换,预设标志位的目标取值为第二取值,表示对当前块不进行二次变换,因此,对目标变换系数矩阵不进行调整。In the above case, if the target parity is an even number, and the target value of the preset flag bit of the current block is the first value, it is determined not to adjust the target transform coefficient matrix. For example, if the target parity is An even number means that the current block is to be transformed twice, and the target value of the preset flag bit is the first value, which also means that the current block is transformed twice, so the target transformation coefficient matrix is not adjusted. Or, if the target parity is an even number, and the target value of the preset flag bit of the current block is the second value, it is determined to adjust the target transform coefficient matrix. For example, if the target parity is an even number, it means The second transformation is performed on the current block, and the target value of the preset flag bit is the second value, which means that the second transformation is not performed on the current block. Therefore, the target transformation coefficient matrix is adjusted. Or, if the target parity is an odd number, and the target value of the preset flag bit of the current block is the first value, it is determined to adjust the target transformation coefficient matrix. For example, if the target parity is an odd number, it means The current block is not subjected to secondary transformation, and the target value of the preset flag bit is the first value, indicating that the current block is subjected to secondary transformation. Therefore, the target transformation coefficient matrix is adjusted. Or, if the target parity is an odd number, and the target value of the preset flag bit of the current block is the second value, it is determined not to adjust the target transform coefficient matrix. For example, if the target parity is an odd number, then Indicates that no secondary transformation is performed on the current block, and the target value of the preset flag bit is the second value, which indicates that secondary transformation is not performed on the current block, therefore, the target transformation coefficient matrix is not adjusted.
示例性的,若不对目标变换系数矩阵进行调整,则执行步骤417。Exemplarily, if the target transformation coefficient matrix is not adjusted,
示例性的,若对目标变换系数矩阵进行调整,则执行步骤418。Exemplarily, if the target transformation coefficient matrix is adjusted,
步骤417,对目标变换系数矩阵进行编码,得到当前块的编码比特流。Step 417: Encode the target transformation coefficient matrix to obtain an encoded bit stream of the current block.
步骤418,对目标变换系数矩阵中的变换系数进行调整,以使调整后的目标变换系数矩阵的目标特征与预设标志位的目标取值相匹配。在对目标变换系数矩阵中的变换系数进行调整后,对调整后的目标变换系数矩阵进行编码,得到当前块的编码比特流。Step 418: Adjust the transform coefficients in the target transform coefficient matrix, so that the adjusted target feature of the target transform coefficient matrix matches the target value of the preset flag bit. After the transformation coefficients in the target transformation coefficient matrix are adjusted, the adjusted target transformation coefficient matrix is encoded to obtain an encoded bit stream of the current block.
例如,若编码端和解码端约定“奇数”与进行二次变换,“偶数”与不进行二次变换的关系,且目标奇偶性为奇数,当前块的预设标志位的目标取值为第二取值,基于此,可以对目标变换系数矩阵中的某个奇数变换系数进行调整,使得该奇数变换系数变更为偶数,如对该奇数变换系数进行加1处理,或减1处理,变更后的变换系数为偶数,不是0。或者,对目标变换系数矩阵中的某个偶数变换系数进行调整,使得该偶数变换系数变更为奇数,如对该偶数变换系数进行加1处理,或减1处理,变更后的变换系数为奇数,不是0。For example, if the encoding end and the decoding end agree on the relationship between "odd number" and secondary transformation, "even number" and no secondary transformation, and the target parity is odd, the target value of the preset flag bit of the current block is the first Two values, based on this, an odd transformation coefficient in the target transformation coefficient matrix can be adjusted so that the odd transformation coefficient is changed to an even number, such as adding 1 to the odd transformation coefficient, or subtracting 1, after the change The transformation coefficient of is an even number, not 0. Or, adjust an even transformation coefficient in the target transformation coefficient matrix so that the even transformation coefficient is changed to an odd number, such as adding 1 to or subtracting 1 from the even transformation coefficient, and the changed transformation coefficient is an odd number, not 0.
经过上述处理,调整后的目标变换系数矩阵的目标奇偶性为偶数,“偶数”表示对当前块不进行二次变换,预设标志位的目标取值为第二取值,表示对当前块不进行二次变换,即调整后的目标变换系数矩阵的目标奇偶性与预设标志位的目标取值相匹配。After the above processing, the target parity of the adjusted target transformation coefficient matrix is an even number, "even number" means that the current block will not be transformed twice, and the target value of the preset flag bit is the second value, which means that the current block will not be transformed twice. A secondary transformation is performed, that is, the adjusted target parity of the target transform coefficient matrix matches the target value of the preset flag bit.
又例如,若目标奇偶性为偶数,当前块的预设标志位的目标取值为第一取值,基于此,可以对目标变换系数矩阵中的某个奇数变换系数进行调整,使得该奇数变换系数变更为偶数,如对该奇数变换系数进行加1处理,或减1处理。或者,对目标变换系数矩阵中的某个偶数变换系数进行调整,使得该偶数变换系数变更为奇数,如对该偶数变换系数进行加1处理,或减1处理。经过上述处理,调整后的目标变换系数矩阵的目标奇偶性为奇数,“奇数”表示对当前块进行二次变换,预设标志位的目标取值为第一取值,表示对当前块进行二次变换,即调整后的目标变换系数矩阵的目标奇偶性与预设标志位的目标取值相匹配。For another example, if the target parity is even, the target value of the preset flag bit of the current block is the first value. Based on this, an odd transform coefficient in the target transform coefficient matrix can be adjusted so that the odd transform The coefficient is changed to an even number, such as adding 1 or subtracting 1 to the odd transform coefficient. Alternatively, an even transformation coefficient in the target transformation coefficient matrix is adjusted so that the even transformation coefficient is changed to an odd number, such as adding 1 to or subtracting 1 from the even transformation coefficient. After the above processing, the target parity of the adjusted target transformation coefficient matrix is an odd number, "odd number" indicates that the current block is subjected to secondary transformation, and the target value of the preset flag bit is the first value, indicating that the current block is subjected to secondary transformation. transformation, that is, the adjusted target parity of the target transform coefficient matrix matches the target value of the preset flag bit.
又例如,若编码端和解码端约定“偶数”与进行二次变换,“奇数”与不进行二次变换的关系,则这种情况的调整过程与上述调整方式类似,在此不再重复赘述。For another example, if the encoding end and the decoding end agree on the relationship between "even number" and secondary transformation, and "odd number" and no secondary transformation, the adjustment process in this case is similar to the above adjustment method, and will not be repeated here. .
综上所述,编码端可以通过目标变换系数矩阵的目标特征(如奇偶性)来隐式表示是否对当前块进行二次变换,而不是通过指示信息来显式表示是否对当前块进行二次变换。To sum up, the encoder can implicitly indicate whether to perform secondary transformation on the current block through the target characteristics (such as parity) of the target transformation coefficient matrix, instead of explicitly indicating whether to perform secondary transformation on the current block through indication information. transform.
示例性的,在编码过程中,若当前块使用(DST7,DST7)变换核进行初始变换,则经过变换量化后的目标变换系数矩阵需要满足:sr_x和sr_y小于16,并且目标变换系数矩阵中所有非零变换系数的个数为奇数,用于表示当前块使用(DST7,DST7)变换核进行初始变换。或者,若当前块使用(DCT2,DCT2)变换核进行初始变换,则经过变换量化后的目标变换系数矩阵需要满足:sr_x或sr_y大于等于16,或者,目标变换系数矩阵中所有非零变换系数的个数为偶数,用于表示当前块使用(DCT2,DCT2)变换核进行初始变换。Exemplarily, in the encoding process, if the current block uses the (DST7, DST7) transform kernel for initial transformation, the target transformation coefficient matrix after transformation and quantization needs to satisfy: sr_x and sr_y are less than 16, and all in the target transformation coefficient matrix The number of non-zero transform coefficients is an odd number, which is used to indicate that the current block uses the (DST7, DST7) transform kernel for initial transform. Or, if the current block uses the (DCT2, DCT2) transform kernel for initial transformation, the target transform coefficient matrix after transformation and quantization needs to satisfy: sr_x or sr_y is greater than or equal to 16, or, all non-zero transform coefficients in the target transform coefficient matrix The number is an even number, which is used to indicate that the current block uses the (DCT2, DCT2) transform kernel for initial transformation.
示例性的,若当前块支持二次变换,当前块支持AST技术,当前块满足第一预设条件,当前块满足第二预设条件,根据当前块对应的率失真代价值确定是否对当前块进行二次变换后,执行步骤415-步骤418,通过隐式方式表示当前块进行二次变换或者不进行二次变换。Exemplarily, if the current block supports secondary transformation, the current block supports AST technology, the current block satisfies the first preset condition, and the current block satisfies the second preset condition, it is determined according to the rate-distortion cost value corresponding to the current block After the secondary transformation is performed,
若当前块不支持二次变换,则确定对当前块不进行二次变换,但是不需要执行步骤415-步骤418,即不需要通过隐式方式表示当前块不进行二次变换。或者,若当前块支持二次变换,当前块不支持AST技术,则确定对当前块不进行二次变换,但是不需要执行步骤415-步骤418,即不需要通过隐式方式表示当前块不进行二次变换。或者,若当前块支持二次变换,当前块支持AST技术,当前块不满足第一预设条件,则确定对当前块不进行二次变换,但是不需要执行步骤415-步骤418,即不需要通过隐式方式表示当前块不进行二次变换。或者,若当前块支持二次变换,当前块支持AST技术,当前块满足第一预设条件,当前块不满足第二预设条件,则确定对当前块进行二次变换,但是不需要执行步骤415-步骤418,即不需要通过隐式方式表示当前块进行二次变换。If the current block does not support secondary transformation, it is determined that secondary transformation is not performed on the current block, but steps 415 to 418 do not need to be performed, that is, there is no need to implicitly indicate that the current block does not undergo secondary transformation. Or, if the current block supports secondary transformation, but the current block does not support AST technology, it is determined that the current block is not subjected to secondary transformation, but steps 415-418 do not need to be performed, that is, it is not necessary to implicitly indicate that the current block does not perform secondary transformation. Or, if the current block supports secondary transformation, the current block supports AST technology, and the current block does not meet the first preset condition, it is determined that the current block is not subjected to secondary transformation, but steps 415-418 do not need to be performed, that is, no In an implicit way, it indicates that the current block does not undergo secondary transformation. Or, if the current block supports secondary transformation, the current block supports AST technology, the current block satisfies the first preset condition, and the current block does not meet the second preset condition, then it is determined to perform secondary transformation on the current block, but no steps need to be performed 415-
由以上技术方案可见,本申请实施例中,编码端可以根据第一预设条件和第二预设条件判断是否允许对当前块进行二次变换,若当前块满足第一预设条件,且当前块也满足第二预设条件,则允许对当前块进行二次变换,基于此,可以根据当前块对应的率失真代价值确定是否对当前块进行二次变换。若当前块不满足第一预设条件,则禁止对当前块进行二次变换,从而剔除不需要进行二次变换的块,起到去冗余的作用,提高编码性能。It can be seen from the above technical solutions that in the embodiment of the present application, the encoding end can judge whether to allow the second transformation of the current block according to the first preset condition and the second preset condition. If the current block satisfies the first preset condition, and the current If the block also satisfies the second preset condition, the current block is allowed to undergo secondary transformation. Based on this, it may be determined whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. If the current block does not meet the first preset condition, it is prohibited to perform secondary transformation on the current block, so as to eliminate blocks that do not need to undergo secondary transformation, play a role in removing redundancy, and improve coding performance.
实施例6:参见图4B所示,为解码方法的流程示意图,可以应用于解码端,该方法包括:Embodiment 6: Referring to FIG. 4B, it is a schematic flow diagram of a decoding method, which can be applied to a decoding end. The method includes:
步骤421,获取当前块的编码比特流,从编码比特流中解析当前块的目标变换系数矩阵。
步骤422,若当前块支持二次变换,当前块支持AST技术,且当前块满足第三预设条件,则确定当前块是否满足第四预设条件;若当前块满足第四预设条件,则根据目标变换系数矩阵中的变换系数,确定目标变换系数矩阵的目标特征。
示例性的,目标特征可以包括但不限于目标奇偶性或者目标正负性。当然,目标奇偶性和目标正负性只是目标特征的两个示例,对此目标特征不做限制。其中,目标奇偶性可以包括但不限于:目标变换系数矩阵中的所有奇数变换系数的个数的奇偶性;或者,目标变换系数矩阵中的所有偶数变换系数的个数的奇偶性;或者,目标变换系数矩阵中的所有变换系数的绝对值之和的奇偶性。当然,上述只是几个示例,对此不做限制,如目标奇偶性还可以为绝对值为1的系数的个数的奇偶性,最后一个非零变换系数的奇偶性等。目标正负性可以包括但不限于:目标变换系数矩阵中的最后一个非零变换系数的正负性;或者,目标变换系数矩阵中的第一个非零变换系数的正负性;或者,目标变换系数矩阵中的第N个非零变换系数的正负性,N的取值任意配置。当然,上述目标正负性只是几个示例,对此不做限制,如目标正负性可以为目标变换系数矩阵中的所有变换系数的绝对值之和的正负性等。Exemplarily, the target feature may include but not limited to target parity or target sign-off. Of course, target parity and target positive/negative are just two examples of target features, and there is no limitation on the target features. Wherein, the target parity may include but not limited to: the parity of the number of all odd transform coefficients in the target transform coefficient matrix; or, the parity of the number of all even transform coefficients in the target transform coefficient matrix; or, the target Parity of the sum of absolute values of all transform coefficients in the transform coefficient matrix. Of course, the above are just a few examples, which are not limited. For example, the target parity may also be the parity of the number of coefficients with an absolute value of 1, the parity of the last non-zero transform coefficient, and the like. The target sign or negativity may include, but is not limited to: the sign of the last non-zero transform coefficient in the target transform coefficient matrix; or, the sign of the first non-zero transform coefficient in the target transform coefficient matrix; or, the target The positive or negative of the Nth non-zero transform coefficient in the transform coefficient matrix, and the value of N can be configured arbitrarily. Of course, the above-mentioned target signabilities are just a few examples, and there is no limitation to this. For example, the target signabilities may be the signabilities of the sum of the absolute values of all transform coefficients in the target transform coefficient matrix.
为了方便描述,后续以目标奇偶性为例进行说明,其它目标特征的处理方式类似。For the convenience of description, target parity is used as an example for description in the following, and other target features are processed in a similar manner.
在得到目标变换系数矩阵后,可以根据目标变换系数矩阵中的变换系数,确定目标变换系数矩阵的目标奇偶性。例如,假设目标奇偶性为目标变换系数矩阵中的所有奇数变换系数的个数的奇偶性,若目标变换系数矩阵中存在30个奇数变换系数,则目标奇偶性为偶数。After the target transform coefficient matrix is obtained, the target parity of the target transform coefficient matrix can be determined according to the transform coefficients in the target transform coefficient matrix. For example, assuming that the target parity is the parity of the number of all odd transform coefficients in the target transform coefficient matrix, if there are 30 odd transform coefficients in the target transform coefficient matrix, the target parity is an even number.
步骤423,根据该目标特征确定当前块的预设标志位的目标取值。Step 423: Determine the target value of the preset flag bit of the current block according to the target feature.
示例性的,该预设标志位的目标取值为第一取值时,用于指示对当前块进行二次逆变换,该预设标志位的目标取值为第二取值时,用于指示对当前块不进行二次逆变换。Exemplarily, when the target value of the preset flag bit is the first value, it is used to indicate that a second inverse transformation is performed on the current block, and when the target value of the preset flag bit is the second value, it is used to Indicates that no secondary inverse transform is to be performed on the current block.
在一种可能的实施方式中,解码端和编码端可以约定目标奇偶性与二次逆变换的关系,例如,目标奇偶性为奇数时,表示对当前块进行二次逆变换,目标奇偶性为偶数时,表示对当前块不进行二次逆变换,即约定“奇数”与进行二次逆变换,“偶数”与不进行二次逆变换的关系。若目标变换系数矩阵的目标奇偶性为奇数,则确定当前块的预设标志位的目标取值为第一取值。示例性的,若目标奇偶性为奇数,则表示对当前块进行二次逆变换,预设标志位的目标取值为第一取值,也表示对当前块进行二次逆变换,即目标奇偶性与目标取值匹配。若目标变换系数矩阵的目标奇偶性为偶数,则确定当前块的预设标志位的目标取值为第二取值。示例性的,若目标奇偶性为偶数,则表示对当前块不进行二次逆变换,预设标志位的目标取值为第二取值,也表示对当前块不进行二次逆变换,即目标奇偶性与目标取值匹配。In a possible implementation manner, the decoding end and the encoding end can agree on the relationship between the target parity and the second inverse transformation. For example, when the target parity is an odd number, it means that the current block is subjected to the second inverse transformation. The target parity is When the number is even, it means that the current block will not be subjected to the second inverse transformation, that is, the relationship between "odd number" and the second inverse transformation, "even number" and no second inverse transformation. If the target parity of the target transformation coefficient matrix is an odd number, then determine that the target value of the preset flag bit of the current block is the first value. Exemplarily, if the target parity is an odd number, it means performing a second inverse transformation on the current block, and the target value of the preset flag bit is the first value, which also means performing a second inverse transformation on the current block, that is, the target parity The property matches the target value. If the target parity of the target transformation coefficient matrix is an even number, then determine the target value of the preset flag bit of the current block as the second value. Exemplarily, if the target parity is an even number, it means that the second inverse transformation is not performed on the current block, and the target value of the preset flag bit is the second value, which also means that the second inverse transformation is not performed on the current block, namely The target parity matches the target value.
在另一种可能的实施方式中,解码端和编码端可以约定目标奇偶性与二次逆变换的关系,例如,目标奇偶性为偶数时,表示对当前块进行二次逆变换,目标奇偶性为奇数时,表示对当前块不进行二次逆变换,即约定“偶数”与进行二次逆变换,“奇数”与不进行二次逆变换的关系。若目标变换系数矩阵的目标奇偶性为偶数,则确定当前块的预设标志位的目标取值为第一取值。示例性的,若目标奇偶性为偶数,则表示对当前块进行二次逆变换,预设标志位的目标取值为第一取值,也表示对当前块进行二次逆变换,即目标奇偶性与目标取值匹配。若目标变换系数矩阵的目标奇偶性为奇数,则确定当前块的预设标志位的目标取值为第二取值。示例性的,若目标奇偶性为奇数,则表示对当前块不进行二次逆变换,预设标志位的目标取值为第二取值,也表示对当前块不进行二次逆变换,即目标奇偶性与目标取值匹配。In another possible implementation, the decoding end and the encoding end can agree on the relationship between the target parity and the second inverse transformation. For example, when the target parity is even, it means that the current block is subjected to the second inverse transformation, and the target parity When it is an odd number, it means that the current block will not be subjected to secondary inverse transformation, that is, the relationship between "even number" and secondary inverse transformation, and "odd number" and no secondary inverse transformation. If the target parity of the target transformation coefficient matrix is an even number, then determine that the target value of the preset flag bit of the current block is the first value. Exemplarily, if the target parity is an even number, it means performing a second inverse transform on the current block, and the target value of the preset flag bit is the first value, which also means performing a second inverse transform on the current block, that is, the target parity The property matches the target value. If the target parity of the target transformation coefficient matrix is an odd number, then determine the target value of the preset flag bit of the current block as the second value. Exemplarily, if the target parity is an odd number, it means that the second inverse transformation is not performed on the current block, and the target value of the preset flag bit is the second value, which also means that the second inverse transformation is not performed on the current block, namely The target parity matches the target value.
步骤424,根据预设标志位的目标取值确定是否对当前块进行二次逆变换。Step 424: Determine whether to perform secondary inverse transformation on the current block according to the target value of the preset flag bit.
示例性的,若预设标志位的目标取值为第一取值,则可以确定对当前块进行二次逆变换;若预设标志位的目标取值为第二取值,则可以确定对当前块不进行二次逆变换。Exemplarily, if the target value of the preset flag bit is the first value, it can be determined to perform a second inverse transform on the current block; if the target value of the preset flag bit is the second value, it can be determined to The current block does not undergo secondary inverse transformation.
步骤425,若对当前块进行二次逆变换,则对目标变换系数矩阵中位于左上角的指定区域的变换系数进行二次逆变换,得到初始变换系数矩阵。若对当前块不进行二次逆变换,则将目标变换系数矩阵确定为初始变换系数矩阵。至此,得到当前块的初始变换系数矩阵。Step 425: If the current block is subjected to the second inverse transformation, perform the second inverse transformation on the transformation coefficients in the specified area in the upper left corner of the target transformation coefficient matrix to obtain the initial transformation coefficient matrix. If no secondary inverse transform is performed on the current block, the target transform coefficient matrix is determined as the initial transform coefficient matrix. So far, the initial transformation coefficient matrix of the current block is obtained.
步骤426,对初始变换系数矩阵进行初始逆变换,得到当前块对应的残差系数矩阵。Step 426: Perform an initial inverse transformation on the initial transformation coefficient matrix to obtain a residual coefficient matrix corresponding to the current block.
步骤427,根据该残差系数矩阵确定当前块的重建值。
示例性的,步骤421-步骤422,步骤425-步骤427,可以参见实施例4,在此不再赘述。Exemplarily, step 421-
综上所述,解码端可以根据目标变换系数矩阵中所有非零变换系数的个数的奇偶性,及sr_x和sr_y得到istTuflag。若istTuflag等于0,表示当前块使用变换核对(DCT2,DCT2)进行初始逆变换,若istTuflag等于1,表示当前块使用变换核对(DST7,DST7)进行初始逆变换。当istTuflag等于0,且当前块满足第三预设条件和第四预设条件,则解码端根据目标变换系数矩阵的目标奇偶性确定是否对目标变换系数矩阵进行二次逆变换。当istTuflag等于0,且当前块不满足第三预设条件,则解码端确定对目标变换系数矩阵不进行二次逆变换。当istTuflag等于0,且当前块满足第三预设条件,但是不满足第四预设条件,则解码端确定对目标变换系数矩阵进行二次逆变换。当istTuflag等于1时,解码端确定当前块不满足第三预设条件,对目标变换系数矩阵不进行二次逆变换。To sum up, the decoder can obtain istTuflag according to the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix, and sr_x and sr_y. If istTuflag is equal to 0, it means that the current block uses the transform check (DCT2, DCT2) for initial inverse transform; if istTuflag is equal to 1, it means that the current block uses the transform check (DST7, DST7) for initial inverse transform. When istTuflag is equal to 0 and the current block satisfies the third preset condition and the fourth preset condition, the decoder determines whether to perform a second inverse transform on the target transform coefficient matrix according to the target parity of the target transform coefficient matrix. When istTuflag is equal to 0 and the current block does not meet the third preset condition, the decoder determines not to perform a second inverse transform on the target transform coefficient matrix. When istTuflag is equal to 0, and the current block satisfies the third preset condition but does not satisfy the fourth preset condition, the decoder determines to perform a second inverse transform on the target transform coefficient matrix. When istTuflag is equal to 1, the decoder determines that the current block does not meet the third preset condition, and does not perform a second inverse transform on the target transform coefficient matrix.
若需要对目标变换系数矩阵进行二次逆变换,则解码端对目标变换系数矩阵进行二次逆变换,得到初始变换系数矩阵,然后再对初始变换系数矩阵进行初始逆变换,得到残差系数矩阵。若对目标变换系数矩阵不进行二次逆变换,则解码端将目标变换系数矩阵确定为初始变换系数矩阵,对初始变换系数矩阵进行初始逆变换,得到残差系数矩阵。If it is necessary to perform a second inverse transformation on the target transformation coefficient matrix, the decoder performs a second inverse transformation on the target transformation coefficient matrix to obtain the initial transformation coefficient matrix, and then performs an initial inverse transformation on the initial transformation coefficient matrix to obtain the residual coefficient matrix . If the target transformation coefficient matrix is not subjected to secondary inverse transformation, the decoding end determines the target transformation coefficient matrix as the initial transformation coefficient matrix, performs initial inverse transformation on the initial transformation coefficient matrix, and obtains the residual coefficient matrix.
然后,可以残差系数矩阵确定当前块的重建值,对此重建过程不再赘述。Then, the reconstruction value of the current block can be determined by the residual coefficient matrix, and the reconstruction process will not be repeated here.
由以上技术方案可见,本申请实施例中,解码端可以根据第三预设条件和第四预设条件判断是否允许对当前块进行二次逆变换,比如说,若当前块满足第三预设条件,且当前块也满足第四预设条件,则允许对当前块进行二次逆变换,并根据当前块的编码比特流确定是否对当前块进行二次逆变换。若当前块不满足第三预设条件,则禁止对当前块进行二次逆变换,即解码端直接确定出当前块不进行二次逆变换,从而剔除不需要进行二次变换的块,起到去冗余的作用,从而提高编码性能。It can be seen from the above technical solutions that in the embodiment of the present application, the decoding end can judge whether to allow the second inverse transformation of the current block according to the third preset condition and the fourth preset condition, for example, if the current block satisfies the third preset condition condition, and the current block also satisfies the fourth preset condition, then the current block is allowed to be subjected to secondary inverse transformation, and whether to perform secondary inverse transformation on the current block is determined according to the coded bit stream of the current block. If the current block does not meet the third preset condition, the second inverse transformation of the current block is prohibited, that is, the decoding end directly determines that the current block does not undergo the second inverse transformation, thereby eliminating the blocks that do not need to undergo the second transformation. The role of de-redundancy, thereby improving the coding performance.
实施例7:在实施例1-实施例4中,针对编码端来说,可以通过RDO来确定是否对当前块进行二次变换,并显式编码指示信息(如secTuflag)来表示是否对当前块进行二次变换,例如,secTuflag的取值为第一取值时,表示对当前块进行二次变换,secTuflag的取值为第二取值时,表示对当前块不进行二次变换。针对解码端来说,在获取到编码比特流后,可以从编码比特流中解析出当前块的指示信息(如secTuflag),若secTuflag的取值为第一取值,则确定对当前块进行二次逆变换,若secTuflag的取值为第二取值,则确定对当前块不进行二次逆变换。以下结合几个具体应用场景,对编码指示信息的实现方式进行说明。Embodiment 7: In Embodiment 1-
应用场景1:针对编码端来说,若当前块支持二次变换,当前块支持AST技术,当前块满足第一预设条件,则判断当前块是否满足第二预设条件,若当前块满足第二预设条件,则可以根据当前块对应的率失真代价值,确定是否对当前块进行二次变换。若当前块不满足第二预设条件,则可以确定对当前块进行二次变换。然后,在根据当前块对应的率失真代价值,确定是否对当前块进行二次变换时,若对当前块进行二次变换,则可以在当前块的编码比特流中添加secTuflag(即指示信息),且secTuflag的取值为第一取值,第一取值用于表示对当前块进行二次变换。若对当前块不进行二次变换,则在当前块的编码比特流中添加secTuflag,且secTuflag的取值为第二取值,第二取值用于表示对当前块不进行二次变换。Application Scenario 1: For the encoding side, if the current block supports secondary transformation, the current block supports AST technology, and the current block meets the first preset condition, then it is judged whether the current block meets the second preset condition. two preset conditions, it may be determined whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. If the current block does not satisfy the second preset condition, it may be determined to perform secondary transformation on the current block. Then, when determining whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block, if the current block is subjected to secondary transformation, secTuflag (that is, indication information) may be added to the coded bitstream of the current block , and the value of secTuflag is the first value, and the first value is used to indicate that a second transformation is performed on the current block. If the current block is not to be transformed twice, secTuflag is added to the coded bit stream of the current block, and the value of secTuflag is the second value, and the second value is used to indicate that the current block is not to be transformed twice.
示例性的,若当前块使用变换核对(DCT2,DCT2)进行初始变换,则经过变换量化后的目标变换系数矩阵需要满足:sr_x大于等于16或sr_y大于等于16,或者,目标变换系数矩阵中所有非零变换系数的个数为偶数,用于表示当前块使用(DCT2,DCT2)变换核进行初始变换。或者,若当前块使用(DST7,DST7)变换核进行初始变换,则经过变换量化后的目标变换系数矩阵需要满足:sr_x和sr_y小于16,并且目标变换系数矩阵中所有非零变换系数的个数为奇数,用于表示当前块使用(DST7,DST7)变换核进行初始变换。Exemplarily, if the current block uses the transformation kernel (DCT2, DCT2) for initial transformation, the target transformation coefficient matrix after transformation and quantization needs to meet: sr_x is greater than or equal to 16 or sr_y is greater than or equal to 16, or, all of the target transformation coefficient matrix The number of non-zero transform coefficients is an even number, which is used to indicate that the current block uses (DCT2, DCT2) transform kernel for initial transform. Or, if the current block uses the (DST7, DST7) transform kernel for initial transformation, the target transform coefficient matrix after transformation and quantization needs to satisfy: sr_x and sr_y are less than 16, and the number of all non-zero transform coefficients in the target transform coefficient matrix It is an odd number, used to indicate that the current block uses (DST7, DST7) transform kernel for initial transformation.
针对解码端来说,根据目标变换系数矩阵中所有非零变换系数的个数的奇偶性,及sr_x和sr_y得到istTuflag。若istTuflag等于0,表示当前块使用变换核对(DCT2,DCT2)进行初始逆变换,若istTuflag等于1,表示当前块使用变换核对(DST7,DST7)进行初始逆变换。For the decoder, istTuflag is obtained according to the parity of the number of all non-zero transform coefficients in the target transform coefficient matrix, and sr_x and sr_y. If istTuflag is equal to 0, it means that the current block uses the transform check (DCT2, DCT2) for initial inverse transform; if istTuflag is equal to 1, it means that the current block uses the transform check (DST7, DST7) for initial inverse transform.
若当前块支持二次变换,当前块支持AST技术,当前块满足第三预设条件,则判断当前块是否满足第四预设条件,若当前块不满足第四预设条件,则解码端确定对当前块进行二次逆变换,此时不需要解码指示信息(secTuflag)。若当前块满足第四预设条件,则解码端可以从编码比特流中解析出secTuflag(即指示信息),基于secTuflag确定是否对当前块进行二次逆变换,例如,若secTuflag的取值为第一取值,则确定对当前块进行二次逆变换。若secTuflag的取值为第二取值,则确定对当前块不进行二次逆变换。If the current block supports secondary transformation, the current block supports AST technology, and the current block satisfies the third preset condition, then it is judged whether the current block satisfies the fourth preset condition, and if the current block does not meet the fourth preset condition, the decoder determines The second inverse transform is performed on the current block, and the decoding indication information (secTuflag) is not required at this time. If the current block satisfies the fourth preset condition, the decoder can parse the secTuflag (ie, indication information) from the encoded bit stream, and determine whether to perform a second inverse transform on the current block based on the secTuflag. For example, if the value of secTuflag is the first If it takes a value, it is determined to perform a second inverse transformation on the current block. If the value of secTuflag is the second value, it is determined not to perform the second inverse transform on the current block.
若对当前块进行二次逆变换,则对目标变换系数矩阵进行二次逆变换,得到初始变换系数矩阵。若对当前块不进行二次逆变换,则将目标变换系数矩阵确定为初始变换系数矩阵。然后,根据初始变换系数矩阵可以得到残差块,而残差块与预测块相加可以得到重建块。If a second inverse transform is performed on the current block, a second inverse transform is performed on the target transform coefficient matrix to obtain an initial transform coefficient matrix. If no secondary inverse transform is performed on the current block, the target transform coefficient matrix is determined as the initial transform coefficient matrix. Then, the residual block can be obtained according to the initial transformation coefficient matrix, and the reconstruction block can be obtained by adding the residual block and the prediction block.
在上述实施例中,第一预设条件或第三预设条件可以包括但不限于:当前块的预测模式为帧内预测模式;当前块为亮度块;当前块的初始变换系数矩阵中含有非零变换系数(如当前块的cbf标志位为第二数值1)。第二预设条件或第四预设条件可以包括但不限于:当前块不使用帧内预测滤波模式(ipf_flag=0);当前块不支持DT划分模式(或当前块支持DT划分模式)。可选地,第二预设条件或第四预设条件还可以包括:前块的宽度和高度满足第一尺寸条件。例如,当前块的宽度W和高度H满足:W<=n1且H<=n2,示例性的,n1和n2可以为:n1=n2=32,或者,n1=n2=64。In the above embodiment, the first preset condition or the third preset condition may include but not limited to: the prediction mode of the current block is intra-frame prediction mode; the current block is a luma block; the initial transformation coefficient matrix of the current block contains non- Zero transform coefficient (for example, the cbf flag of the current block is the second value 1). The second preset condition or the fourth preset condition may include but not limited to: the current block does not use the intra prediction filtering mode (ipf_flag=0); the current block does not support the DT division mode (or the current block supports the DT division mode). Optionally, the second preset condition or the fourth preset condition may further include: the width and height of the front block satisfy the first size condition. For example, the width W and height H of the current block satisfy: W<=n1 and H<=n2. Exemplarily, n1 and n2 may be: n1=n2=32, or, n1=n2=64.
应用场景2:针对编码端来说,若当前块支持二次变换,当前块支持AST技术,当前块满足第一预设条件,则需要判断当前块是否满足第二预设条件,若当前块满足第二预设条件,则可以根据当前块对应的率失真代价值,确定是否对当前块进行二次变换。然后,若对当前块进行二次变换,则可以在当前块的编码比特流中添加secTuflag(即指示信息),且secTuflag的取值为第一取值,第一取值用于表示对当前块进行二次变换。若对当前块不进行二次变换,则在当前块的编码比特流中添加secTuflag,且secTuflag的取值为第二取值,第二取值用于表示对当前块不进行二次变换。Application scenario 2: For the encoding side, if the current block supports secondary transformation, the current block supports AST technology, and the current block meets the first preset condition, it needs to judge whether the current block meets the second preset condition. If the current block meets the In the second preset condition, it may be determined whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. Then, if the current block is re-transformed, secTuflag (that is, indication information) can be added to the coded bitstream of the current block, and the value of secTuflag is the first value, and the first value is used to indicate that the current block Perform a secondary transformation. If the current block is not to be transformed twice, secTuflag is added to the coded bit stream of the current block, and the value of secTuflag is the second value, and the second value is used to indicate that the current block is not to be transformed twice.
针对解码端来说,若当前块支持二次变换,当前块支持AST技术,当前块满足第三预设条件,则判断当前块是否满足第四预设条件,若当前块满足第四预设条件,则从编码比特流中解析出secTuflag(即指示信息),基于secTuflag确定是否对当前块进行二次逆变换,例如,若secTuflag的取值为第一取值,则确定对当前块进行二次逆变换。若secTuflag的取值为第二取值,则确定对当前块不进行二次逆变换。For the decoding end, if the current block supports secondary transformation, the current block supports AST technology, and the current block satisfies the third preset condition, then it is judged whether the current block satisfies the fourth preset condition, and if the current block satisfies the fourth preset condition , then parse out secTuflag (that is, the indication information) from the encoded bit stream, and determine whether to perform a second inverse transform on the current block based on secTuflag, for example, if the value of secTuflag is the first value, then determine to perform a second inverse transform on the current block inverse transformation. If the value of secTuflag is the second value, it is determined not to perform the second inverse transform on the current block.
在上述实施例中,第一预设条件或第三预设条件可以包括但不限于:当前块的预测模式为帧内预测模式;当前块为亮度块;当前块的初始变换系数矩阵中含有非零变换系数(如当前块的cbf标志位为第二数值1)。第二预设条件或第四预设条件可以包括但不限于:当前块使用帧内预测滤波模式(ipf_flag=1);当前块不支持DT划分模式(或当前块支持DT划分模式)。可选地,第二预设条件或第四预设条件还可以包括:前块的宽度和高度满足第一尺寸条件。例如,当前块的宽度W和高度H满足:W<=n1且H<=n2,示例性的,n1和n2可以为:n1=n2=32,或者,n1=n2=64。In the above embodiment, the first preset condition or the third preset condition may include but not limited to: the prediction mode of the current block is intra-frame prediction mode; the current block is a luma block; the initial transformation coefficient matrix of the current block contains non- Zero transform coefficient (for example, the cbf flag of the current block is the second value 1). The second preset condition or the fourth preset condition may include but not limited to: the current block uses the intra prediction filtering mode (ipf_flag=1); the current block does not support the DT division mode (or the current block supports the DT division mode). Optionally, the second preset condition or the fourth preset condition may further include: the width and height of the front block satisfy the first size condition. For example, the width W and height H of the current block satisfy: W<=n1 and H<=n2. Exemplarily, n1 and n2 may be: n1=n2=32, or, n1=n2=64.
应用场景3:在应用场景1或应用场景2的基础上,针对编码端来说,若确定需要对当前块进行二次变换,则基于当前块的尺寸限制条件对当前块进行二次变换。例如,若当前块的宽度和高度满足第二尺寸条件,则对初始变换系数矩阵中位于左上角的第一指定区域(如8*8区域)的变换系数进行二次变换。若当前块的宽度和高度不满足第二尺寸条件,则对初始变换系数矩阵中位于左上角的第二指定区域(如4*4区域)的变换系数进行二次变换。Application Scenario 3: On the basis of
示例性的,编码端在对位于左上角的第一指定区域(如8*8区域)的变换系数进行二次变换时,使用的二次变换矩阵是8*8的二次变换矩阵。在对位于左上角的第二指定区域(如4*4区域)的变换系数进行二次变换时,使用的二次变换矩阵是4*4的二次变换矩阵。Exemplarily, when the encoding end performs secondary transformation on the transformation coefficients of the first specified area (such as the 8*8 area) located in the upper left corner, the secondary transformation matrix used is an 8*8 secondary transformation matrix. When performing secondary transformation on the transformation coefficients of the second designated area (eg, 4*4 area) located in the upper left corner, the secondary transformation matrix used is a 4*4 secondary transformation matrix.
针对解码端来说,若确定需要对当前块进行二次逆变换,则可以基于当前块的尺寸限制条件对当前块进行二次逆变换。例如,若当前块的宽度和高度满足第二尺寸条件,则可以对目标变换系数矩阵中位于左上角的第一指定区域(如8*8区域)的变换系数进行二次逆变换。若当前块的宽度和高度不满足第二尺寸条件,则可以对目标变换系数矩阵中位于左上角的第二指定区域(如4*4区域)的变换系数进行二次逆变换。示例性的,解码端在对位于左上角的第一指定区域(如8*8区域)的变换系数进行二次逆变换时,使用的二次逆变换矩阵是8*8的二次逆变换矩阵。在对位于左上角的第二指定区域(如4*4区域)的变换系数进行二次逆变换时,使用的二次逆变换矩阵是4*4的二次逆变换矩阵。For the decoding end, if it is determined that the current block needs to be subjected to the second inverse transformation, then the current block may be subjected to the second inverse transformation based on the size restriction condition of the current block. For example, if the width and height of the current block satisfy the second size condition, a second inverse transform may be performed on the transform coefficients of the first specified area (eg, 8*8 area) located in the upper left corner of the target transform coefficient matrix. If the width and height of the current block do not satisfy the second size condition, a second inverse transform may be performed on the transform coefficients of the second specified area (eg, 4*4 area) located in the upper left corner of the target transform coefficient matrix. Exemplarily, when the decoding end performs a second inverse transform on the transform coefficients of the first designated area (such as an 8*8 area) located in the upper left corner, the second inverse transform matrix used is an 8*8 second inverse transform matrix . When the second inverse transformation is performed on the transformation coefficients of the second specified area (such as 4*4 area) located in the upper left corner, the second inverse transformation matrix used is a 4*4 second inverse transformation matrix.
示例性的,上述8*8的二次变换矩阵与8*8的二次逆变换矩阵可以相同,即二者为同一个矩阵。上述4*4的二次变换矩阵与4*4的二次逆变换矩阵可以相同。Exemplarily, the above-mentioned 8*8 secondary transformation matrix and the 8*8 secondary inverse transformation matrix may be the same, that is, they are the same matrix. The above-mentioned 4*4 secondary transformation matrix and the 4*4 secondary inverse transformation matrix may be the same.
示例性的,当前块的宽度W和高度H满足第二尺寸条件,可以为以下条件的至少一种:Exemplarily, the width W and height H of the current block satisfy the second size condition, which may be at least one of the following conditions:
条件1:W>=n3,且H>=n4,例如,W>=8,H>=8。Condition 1: W>=n3, and H>=n4, for example, W>=8, H>=8.
条件2:W>=n5,且H>n6,例如,W>=8,且H>8。Condition 2: W>=n5, and H>n6, for example, W>=8, and H>8.
条件3:W>n7,且H>=n8,例如,W>8,且H>=8。Condition 3: W>n7, and H>=n8, for example, W>8, and H>=8.
实施例8:在实施例1,实施例2,实施例5,实施例6中,针对编码端来说,可以通过RDO来确定是否对当前块进行二次变换,并通过目标变换系数矩阵的目标特征(如目标奇偶性等)来隐式表示是否对当前块进行二次变换,而不是通过指示信息来显式表示是否对当前块进行二次变换。针对解码端来说,获取到编码比特流后,从编码比特流中解析出目标变换系数矩阵,并根据目标变换系数矩阵的目标特征确定当前块的预设标志位的目标取值(如secTuflag),即推导出当前块的预设标志位的目标取值。若预设标志位的目标取值为第一取值,则确定对当前块进行二次逆变换。若预设标志位的目标取值为第二取值,则确定对当前块不进行二次逆变换。以下结合几个具体应用场景,对隐式表示的实现方式进行说明。Embodiment 8: In
应用场景4:针对编码端来说,若当前块支持二次变换,当前块支持AST技术,当前块满足第一预设条件,则需要判断当前块是否满足第二预设条件,若当前块满足第二预设条件,则根据当前块对应的率失真代价值,确定是否对当前块进行二次变换。若当前块不满足第二预设条件,则确定对当前块进行二次变换。然后,在根据当前块对应的率失真代价值,确定是否对当前块进行二次变换时,若对当前块进行二次变换,则将目标变换系数矩阵中的所有奇数变换系数的个数的奇偶性(或所有偶数变换系数的个数的奇偶性)调整为偶数。若对当前块不进行二次变换,则将目标变换系数矩阵中的所有奇数变换系数的个数的奇偶性调整为奇数。Application scenario 4: For the encoding side, if the current block supports secondary transformation, the current block supports AST technology, and the current block meets the first preset condition, it needs to judge whether the current block meets the second preset condition. The second preset condition is to determine whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. If the current block does not satisfy the second preset condition, it is determined to perform secondary transformation on the current block. Then, when determining whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block, if the current block is subjected to secondary transformation, the parity of the number of all odd transformation coefficients in the target transformation coefficient matrix (or the parity of the number of all even transform coefficients) is adjusted to an even number. If the current block is not to be transformed twice, the parity of the number of all odd transform coefficients in the target transform coefficient matrix is adjusted to be odd.
针对解码端来说,若当前块支持二次变换,当前块支持AST技术,当前块满足第三预设条件,则判断当前块是否满足第四预设条件,若当前块不满足第四预设条件,则解码端可以确定对当前块进行二次逆变换。若当前块满足第四预设条件,则解码端确定目标变换系数矩阵中的所有奇数变换系数的个数(num_odd)的奇偶性,并根据该num_odd来导出secTuflag,基于secTuflag确定是否对当前块进行二次逆变换。例如,若该num_odd为偶数,则导出secTuflag的取值为第一取值(如0),此时,解码端确定对当前块进行二次逆变换。若该num_odd为奇数,则导出secTuflag的取值为第二取值(如1),此时,解码端确定对当前块不进行二次逆变换。For the decoding end, if the current block supports secondary transformation, the current block supports AST technology, and the current block satisfies the third preset condition, then it is judged whether the current block satisfies the fourth preset condition; if the current block does not meet the fourth preset condition condition, the decoder can determine to perform a second inverse transform on the current block. If the current block satisfies the fourth preset condition, the decoding end determines the parity of the number (num_odd) of all odd transform coefficients in the target transform coefficient matrix, and derives secTuflag according to the num_odd, and determines whether to perform the current block based on secTuflag Secondary inverse transformation. For example, if the num_odd is an even number, the value of secTuflag is derived as the first value (such as 0), and at this time, the decoding end determines to perform a second inverse transform on the current block. If the num_odd is an odd number, the derived value of secTuflag is the second value (such as 1), and at this time, the decoder determines not to perform the second inverse transform on the current block.
在上述实施例中,第一预设条件或第三预设条件可以包括:当前块的预测模式为帧内预测模式;当前块为亮度块;当前块的初始变换系数矩阵中含有非零变换系数。第二预设条件或第四预设条件可以包括:当前块不使用帧内预测滤波模式(ipf_flag=0);当前块不支持DT划分模式(或当前块支持DT划分模式)。可选地,第二预设条件或第四预设条件还可以包括:前块的宽度和高度满足第一尺寸条件。In the above embodiment, the first preset condition or the third preset condition may include: the prediction mode of the current block is an intra prediction mode; the current block is a luma block; the initial transform coefficient matrix of the current block contains non-zero transform coefficients . The second preset condition or the fourth preset condition may include: the current block does not use the intra prediction filtering mode (ipf_flag=0); the current block does not support the DT division mode (or the current block supports the DT division mode). Optionally, the second preset condition or the fourth preset condition may further include: the width and height of the front block satisfy the first size condition.
应用场景5:针对编码端来说,若当前块支持二次变换,当前块支持AST技术,当前块满足第一预设条件,则需要判断当前块是否满足第二预设条件,若当前块满足第二预设条件,则根据当前块对应的率失真代价值,确定是否对当前块进行二次变换。若对当前块进行二次变换,则将目标变换系数矩阵中的所有奇数变换系数的个数的奇偶性(或所有偶数变换系数的个数的奇偶性)调整为偶数。若对当前块不进行二次变换,则将目标变换系数矩阵中的所有奇数变换系数的个数的奇偶性调整为奇数。Application scenario 5: For the encoding side, if the current block supports secondary transformation, the current block supports AST technology, and the current block meets the first preset condition, it needs to judge whether the current block meets the second preset condition. If the current block meets the The second preset condition is to determine whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block. If the current block is to be transformed twice, the parity of the number of all odd transform coefficients (or the parity of the number of all even transform coefficients) in the target transform coefficient matrix is adjusted to an even number. If the current block is not to be transformed twice, the parity of the number of all odd transform coefficients in the target transform coefficient matrix is adjusted to be odd.
针对解码端来说,若当前块支持二次变换,当前块支持AST技术,当前块满足第四预设条件,则判断当前块是否满足第四预设条件,若当前块满足第四预设条件,则解码端确定目标变换系数矩阵中的所有奇数变换系数的个数(num_odd)的奇偶性,并根据该num_odd来导出secTuflag,基于secTuflag确定是否对当前块进行二次逆变换。例如,若该num_odd为偶数,则导出secTuflag的取值为第一取值(如0),此时,解码端确定对当前块进行二次逆变换。若该num_odd为奇数,则导出secTuflag的取值为第二取值(如1),此时,解码端确定对当前块不进行二次逆变换。For the decoder, if the current block supports secondary transformation, the current block supports AST technology, and the current block satisfies the fourth preset condition, then it is judged whether the current block satisfies the fourth preset condition, and if the current block satisfies the fourth preset condition , the decoding end determines the parity of the number (num_odd) of all odd transform coefficients in the target transform coefficient matrix, and derives secTuflag according to the num_odd, and determines whether to perform a second inverse transform on the current block based on secTuflag. For example, if the num_odd is an even number, the value of secTuflag is derived as the first value (such as 0), and at this time, the decoding end determines to perform a second inverse transform on the current block. If the num_odd is an odd number, the derived value of secTuflag is the second value (such as 1), and at this time, the decoder determines not to perform the second inverse transform on the current block.
在上述实施例中,第一预设条件或第三预设条件可以包括:当前块的预测模式为帧内预测模式;当前块为亮度块;当前块的初始变换系数矩阵中含有非零变换系数。第二预设条件或第四预设条件可以包括:当前块使用帧内预测滤波模式(ipf_flag=1);当前块不支持DT划分模式(或当前块支持DT划分模式)。可选地,第二预设条件或第四预设条件还可以包括:前块的宽度和高度满足第一尺寸条件。In the above embodiment, the first preset condition or the third preset condition may include: the prediction mode of the current block is an intra prediction mode; the current block is a luma block; the initial transform coefficient matrix of the current block contains non-zero transform coefficients . The second preset condition or the fourth preset condition may include: the current block uses the intra prediction filtering mode (ipf_flag=1); the current block does not support the DT division mode (or the current block supports the DT division mode). Optionally, the second preset condition or the fourth preset condition may further include: the width and height of the front block satisfy the first size condition.
应用场景6:针对编码端来说,若对当前块进行二次变换,则将目标变换系数矩阵中的所有奇数变换系数的个数的奇偶性调整为奇数。若对当前块不进行二次变换,则将目标变换系数矩阵中的所有奇数变换系数的个数的奇偶性调整为偶数。针对解码端来说,确定目标变换系数矩阵中的所有奇数变换系数的个数(num_odd)的奇偶性,并根据该num_odd来导出secTuflag,基于secTuflag确定是否对当前块进行二次逆变换。例如,若num_odd为奇数,则导出secTuflag的取值为第一取值(如0),确定对当前块进行二次逆变换。若num_odd为偶数,则导出secTuflag的取值为第二取值(如1),确定对当前块不进行二次逆变换。Application scenario 6: For the encoding side, if the current block is transformed twice, the parity of the number of all odd transform coefficients in the target transform coefficient matrix is adjusted to be odd. If the current block is not to be transformed twice, the parity of the number of all odd transform coefficients in the target transform coefficient matrix is adjusted to be even. For the decoding end, determine the parity of the number (num_odd) of all odd transform coefficients in the target transform coefficient matrix, and derive secTuflag according to the num_odd, and determine whether to perform a second inverse transform on the current block based on secTuflag. For example, if num_odd is an odd number, the value of secTuflag is derived as the first value (such as 0), and it is determined to perform a second inverse transformation on the current block. If num_odd is an even number, then derive the value of secTuflag as the second value (such as 1), and determine not to perform the second inverse transform on the current block.
编码端确定是否对当前块进行二次变换,可以参见应用场景4或应用场景5,解码端确定是否对当前块进行二次变换,可以参见应用场景4或应用场景5,在此不再赘述。For determining whether to perform secondary transformation on the current block at the encoding end, refer to
应用场景7:在应用场景4-应用场景6的基础上,针对编码端来说,若确定需要对当前块进行二次变换,则基于当前块的尺寸限制条件对当前块进行二次变换。例如,若当前块的宽度和高度满足第二尺寸条件,则对初始变换系数矩阵中位于左上角的第一指定区域(如8*8区域)的变换系数进行二次变换。若当前块的宽度和高度不满足第二尺寸条件,则对初始变换系数矩阵中位于左上角的第二指定区域(如4*4区域)的变换系数进行二次变换。Application Scenario 7: On the basis of Application Scenario 4-Application Scenario 6, for the encoding side, if it is determined that the current block needs to be re-transformed, then the current block is re-transformed based on the size constraints of the current block. For example, if the width and height of the current block satisfy the second size condition, a second transform is performed on the transform coefficients of the first specified area (such as 8*8 area) located in the upper left corner in the initial transform coefficient matrix. If the width and height of the current block do not satisfy the second size condition, perform secondary transformation on the transformation coefficients of the second specified area (
示例性的,针对解码端来说,若确定需要对当前块进行二次逆变换,则可以基于当前块的尺寸限制条件对当前块进行二次逆变换。例如,若当前块的宽度和高度满足第二尺寸条件,则可以对目标变换系数矩阵中位于左上角的第一指定区域(如8*8区域)的变换系数进行二次逆变换。若当前块的宽度和高度不满足第二尺寸条件,则可以对目标变换系数矩阵中位于左上角的第二指定区域(如4*4区域)的变换系数进行二次逆变换。Exemplarily, for the decoding end, if it is determined that the current block needs to be subjected to the second inverse transformation, then the current block may be subjected to the second inverse transformation based on the size restriction condition of the current block. For example, if the width and height of the current block satisfy the second size condition, a second inverse transform may be performed on the transform coefficients of the first specified area (eg, 8*8 area) located in the upper left corner of the target transform coefficient matrix. If the width and height of the current block do not satisfy the second size condition, a second inverse transform may be performed on the transform coefficients of the second specified area (eg, 4*4 area) located in the upper left corner of the target transform coefficient matrix.
实施例9:在上述实施例1-实施例8中,涉及帧内预测滤波(Intra PredictionFilter,IPF),以下对帧内预测滤波技术进行说明。帧内预测滤波可以使用1比特表示是否允许对当前块使用帧内预测滤波,可以在RDO阶段确定是否需要对当前块使用帧内预测滤波。另外,帧内预测滤波技术需要根据当前块的帧内预测模式选择参考像素,可以分为以下三种情况。Embodiment 9: In the foregoing
情况1:对于DC模式,Plane模式和Bilinear模式,使用左侧的一列重建像素和上侧的一行重建像素作为参考像素,使用3抽头滤波器,如可以采用如下公式进行帧内预测滤波:Case 1: For DC mode, Plane mode and Bilinear mode, use a column of reconstructed pixels on the left and a row of reconstructed pixels on the upper side as reference pixels, and use a 3-tap filter. For example, the following formula can be used for intra prediction filtering:
P′(x,y)=f(x)·P(-1,y)+f(y)·P(x,-1)+(1-f(x)-f(y))·P(x,y)P'(x, y) = f(x)·P(-1, y)+f(y)·P(x,-1)+(1-f(x)-f(y))·P( x,y)
在上述公式中,0≤x,y<N,P′(x,y)为滤波后的帧内预测值,P(x,y)为常规帧内预测模式得到的帧内预测值,f(x)和f(y)为滤波系数,N为当前块的尺寸。In the above formula, 0≤x, y<N, P'(x, y) is the filtered intra-frame prediction value, P(x, y) is the intra-frame prediction value obtained by the conventional intra-frame prediction mode, f( x) and f(y) are filter coefficients, and N is the size of the current block.
情况2:对于HPM中的竖直预测模式(如模式3~模式18),使用左侧的一列重建像素作为参考像素,使用2抽头滤波器,例如,可以采用如下公式进行帧内预测滤波:Case 2: For the vertical prediction mode (such as
P′(x,y)=f(x)·P(-1,y)+(1-f(x))·P(x,y)P'(x,y)=f(x)·P(-1,y)+(1-f(x))·P(x,y)
在上述公式中,x<N,P′(x,y)可以为滤波后的帧内预测值,P(x,y)可以为常规帧内预测模式得到的帧内预测值,f(x)和f(y)可以为滤波系数,N为当前块的尺寸。In the above formula, x<N, P'(x, y) can be the filtered intra-frame prediction value, P(x, y) can be the intra-frame prediction value obtained by the conventional intra-frame prediction mode, f(x) and f(y) may be filter coefficients, and N is the size of the current block.
情况3:对于HPM中的水平预测模式(如模式19~模式32),使用上侧的一行重建像素作为参考像素,使用2抽头滤波器,例如,可以采用如下公式进行帧内预测滤波:Case 3: For the horizontal prediction mode in HPM (such as
P′(x,y)=f(y)·P(x,-1)+(1-f(y))·P(x,y)P'(x,y)=f(y)·P(x,-1)+(1-f(y))·P(x,y)
在上述公式中,y<N,P′(x,y)可以为滤波后的帧内预测值,P(x,y)可以为常规帧内预测模式得到的帧内预测值,f(x)和f(y)可以为滤波系数,N为当前块的尺寸。In the above formula, y<N, P'(x, y) can be the filtered intra-frame prediction value, P(x, y) can be the intra-frame prediction value obtained by the conventional intra-frame prediction mode, f(x) and f(y) may be filter coefficients, and N is the size of the current block.
示例性的,针对情况1、情况2和情况3,为了避免浮点运算,还可以将滤波系数定点化,如针对情况1的帧内预测滤波公式,可以替换为如下公式,在如下公式中,F(x)和F(y)是定点化之后的系数,即将f(x)和f(y)转换为F(x)和F(y),情况2和情况3类似,在此不再赘述。Exemplarily, for
p′(x)=(F(x)·p(-1,y)+F(y)·p(x,-1)+(64-F(x)-F(y))·p(x)+32)>>6p'(x)=(F(x)·p(-1,y)+F(y)·p(x,-1)+(64-F(x)-F(y))·p(x )+32)>>6
示例性的,F(x)和F(y)可以为滤波系数(即经过放大之后的滤波器系数),参见表3所示,示出了滤波系数的一个示例,该滤波系数与块尺寸和距离参考像素的距离均有关系。在表3中,预测块尺寸表示当前块的宽度或者高度,距离参考像素的距离表示预测距离,表3中将最大预测距离设为10,在实际应用中,最大预测距离还可以更大,对此不做限制。Exemplarily, F(x) and F(y) may be filter coefficients (that is, filter coefficients after amplification), as shown in Table 3, which shows an example of filter coefficients, which are related to the block size and The distance from the reference pixel is all relevant. In Table 3, the prediction block size represents the width or height of the current block, and the distance from the reference pixel represents the prediction distance. In Table 3, the maximum prediction distance is set to 10. In practical applications, the maximum prediction distance can be larger. For This is not limited.
表3table 3
例如,针对当前块的第一行第3列的像素位置A,假设参考像素为左侧的一列重建像素,则像素位置A与参考像素的距离为3,假设当前块的尺寸为4*4,则滤波系数可以为2,假设当前块的尺寸为8*8,则滤波系数可以为14,假设当前块的尺寸为16*16,则滤波系数可以为19,假设当前块的尺寸为32*32,则滤波系数可以为21,以此类推。针对其它像素位置,滤波系数的确定方式与像素位置A的滤波系数的确定方式类似,在此不再赘述。For example, for the pixel position A of the first row and the third column of the current block, assuming that the reference pixel is a column of reconstructed pixels on the left, the distance between the pixel position A and the reference pixel is 3, assuming that the size of the current block is 4*4, Then the filter coefficient can be 2, assuming the size of the current block is 8*8, the filter coefficient can be 14, assuming the size of the current block is 16*16, the filter coefficient can be 19, assuming the size of the current block is 32*32 , the filter coefficient can be 21, and so on. For other pixel positions, the method of determining the filter coefficient is similar to the method of determining the filter coefficient of pixel position A, which will not be repeated here.
实施例10:在上述实施例1-实施例8中,涉及编码端对位于左上角的4*4区域的变换系数进行二次变换,或者,解码端对位于左上角的4*4区域的变换系数进行二次逆变换。从编码端来说,是经过(DCT2,DCT2)变换后得到变换系数,然后对左上角的4*4的变换系数,再与二次变换矩阵相乘得到新变换系数,然后再进行量化和熵编码。从解码端来说,对于从码流熵解码得到的变换系数经过反量化后,对于左上角的4*4区域先进行二次逆变换,得到新变换系数,然后对整个变换块使用(DCT2,DCT2)进行逆变换,得到残差系数。Embodiment 10: In the above-mentioned Embodiment 1-Embodiment 8, the encoding end performs secondary transformation on the transformation coefficient of the 4*4 area located in the upper left corner, or the decoding end performs transformation on the 4*4 area located in the upper left corner Coefficients undergo a second inverse transformation. From the encoding side, the transformation coefficient is obtained after (DCT2, DCT2) transformation, and then the 4*4 transformation coefficient in the upper left corner is multiplied by the secondary transformation matrix to obtain the new transformation coefficient, and then quantized and entropy coding. From the perspective of the decoder, after inverse quantization of the transformation coefficients obtained from entropy decoding of the code stream, a second inverse transformation is performed on the 4*4 area in the upper left corner to obtain new transformation coefficients, and then the entire transformation block is used (DCT2, DCT2) is inversely transformed to obtain residual coefficients.
在一种可能的实施方式中,二次变换具体解码端反变换过程如下:In a possible implementation manner, the specific inverse transformation process at the decoding end of the secondary transformation is as follows:
情况一、如果当前块的宽度或者高度的值大于4,且二次变换启用标志的值等于1(二次变换启用标志的值等于1,表示序列级或者帧级允许启用二次变换),则对系数矩阵执行以下操作:首先,由变换系数矩阵得到左上角4*4的系数矩阵C:cij=coeffij,i=0~3,j=0~3,在上述公式中,cij是矩阵C的元素,coeffij是变换系数矩阵的元素。
示例性的,如果帧内预测模式的值为0~2,或13~32,或44~65,且当前块外部左边的参考样本“可用”,则:cij=Clip3(-32768,32767,(pij+26)>>7),i=0~3,j=0~3。pij是4*4的矩阵P的元素,矩阵P的计算方式如下:P=C×S4,S4是4*4逆变换矩阵,Clip3(-32768,32767,(pij+26)>>7)表示,若cij的值位于-32768与32767之间,则cij的值为(pij+26)>>7,若cij的值小于-32768,则cij的值为-32768,若cij的值大于32767,则cij的值为32767。Exemplarily, if the value of the intra prediction mode is 0~2, or 13~32, or 44~65, and the reference sample on the left outside the current block is "available", then: c ij =Clip3(-32768, 32767, (p ij +2 6 )>>7), i=0~3, j=0~3. p ij is the element of 4*4 matrix P, and the calculation method of matrix P is as follows: P=C×S 4 , S 4 is the 4*4 inverse transformation matrix, Clip3(-32768, 32767, (p ij +2 6 ) >>7) means that if the value of c ij is between -32768 and 32767, then the value of c ij is (p ij +2 6 )>>7, if the value of c ij is less than -32768, then the value of c ij is -32768, if the value of c ij is greater than 32767, then the value of c ij is 32767.
示例性的,如果帧内预测模式的值为0~23,或34~57,且当前块外部上边的参考样本“可用”,则:cij=Clip3(-32768,32767,(qij+26)>>7),i=0~3,j=0~3。qij是4×4矩阵Q的元素,矩阵Q的计算方式如下:Q=S4 T×C,S4 T是S4的转置矩阵,S4是4*4逆变换矩阵。Exemplarily, if the value of the intra prediction mode is 0 to 23, or 34 to 57, and the reference sample on the outside of the current block is "available", then: c ij =Clip3(-32768,32767,(q ij +2 6 )>>7), i=0~3, j=0~3. q ij is the element of 4×4 matrix Q, and the calculation method of matrix Q is as follows: Q=S 4 T ×C, S 4 T is the transposition matrix of S 4 , and S 4 is the 4*4 inverse transformation matrix.
然后,根据矩阵C修改变换系数矩阵的元素的值:coeffij=cij,i=0~3,j=0~3。Then, modify the values of the elements of the transformation coefficient matrix according to the matrix C: coeff ij = cij , i=0~3, j=0~3.
然后,对矩阵coeff进行初始逆变换。Then, an initial inverse transformation is performed on the matrix coeff.
情况二、如果当前块的宽度和高度的值均等于4,且二次变换启用标志的值等于1(二次变换启用标志的值等于1,表示序列级或者帧级允许启用二次变换),则对系数矩阵执行以下操作:首先,对变换系数矩阵进行如下垂直反变换,得到矩阵K:kij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1,vij是矩阵V的元素,kij是矩阵K的元素。矩阵V的计算如下:V=D4 T×CoeffMatrix,D4 T是反变换矩阵D4的转置矩阵,CoeffMatrix为变换系数。
然后,对矩阵K进行如下水平反变换,得到矩阵H:hij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1),i=0~M1-1,j=0~M2-1,wi,j是矩阵W的元素,hij是矩阵H的元素。MaxValue的值为(1<<BitDepth)-1,shift1等于22-BitDepth,矩阵W为:W=K×D4,D4是反变换矩阵。Then, perform the following horizontal inverse transformation on matrix K to obtain matrix H: h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1), i=0~M 1 -1, j=0 to M 2 -1, w i,j are elements of matrix W, and h ij are elements of matrix H. The value of MaxValue is (1<<BitDepth)-1, shift1 is equal to 22-BitDepth, the matrix W is: W=K×D 4 , and D 4 is an inverse transformation matrix.
示例性的,对于4*4的块,进行完二次变换的逆变换后不需要再进行初始逆变换。Exemplarily, for a 4*4 block, the initial inverse transformation does not need to be performed after the inverse transformation of the secondary transformation is performed.
实施例11:在上述实施例1-实施例8中,涉及编码端对位于左上角的8*8区域的变换系数进行二次变换,或者,解码端对位于左上角的8*8区域的变换系数进行二次逆变换。从编码端来说,是经过(DCT2,DCT2)变换后得到变换系数,然后对左上角的8*8的变换系数,再与二次变换矩阵相乘得到新变换系数,然后再进行量化和熵编码。从解码端来说,对于从码流熵解码得到的变换系数经过反量化后,对于左上角的8*8区域先进行二次逆变换,得到新变换系数,然后对整个变换块使用(DCT2,DCT2)进行逆变换,得到残差系数。Embodiment 11: In the above-mentioned Embodiment 1-Embodiment 8, the encoding end performs secondary transformation on the transformation coefficient of the 8*8 area located in the upper left corner, or the decoding end performs transformation on the 8*8 area located in the upper left corner Coefficients undergo a second inverse transformation. From the encoding side, the transformation coefficient is obtained after (DCT2, DCT2) transformation, and then the 8*8 transformation coefficient in the upper left corner is multiplied by the secondary transformation matrix to obtain the new transformation coefficient, and then quantized and entropy coding. From the decoding side, after inverse quantization of the transformation coefficients obtained from the entropy decoding of the code stream, a second inverse transformation is performed on the 8*8 area in the upper left corner to obtain new transformation coefficients, and then the entire transformation block is used (DCT2, DCT2) is inversely transformed to obtain residual coefficients.
在一种可能的实施方式中,二次变换具体解码端反变换过程如下:In a possible implementation manner, the specific inverse transformation process at the decoding end of the secondary transformation is as follows:
情况一、如果当前块的宽度或者高度的值大于8,且二次变换启用标志的值等于1(二次变换启用标志的值等于1,表示序列级或者帧级允许启用二次变换),则对系数矩阵执行以下操作:首先,由变换系数矩阵得到左上角8*8的系数矩阵C:cij=coeffij,i=0~7,j=0~7,在上述公式中,cij是矩阵C的元素,coeffij是变换系数矩阵的元素。
示例性的,如果帧内预测模式的值为0~2,或13~32,或44~65,且当前块外部左边的参考样本“可用”,则:cij=Clip3(-32768,32767,(pij+26)>>7),i=0~7,j=0~7。pij是8*8的矩阵P的元素,矩阵P的计算方式如下:P=C×S8,S8是8*8逆变换矩阵,Clip3(-32768,32767,(pij+26)>>7)表示,若cij的值位于-32768与32767之间,则cij的值为(pij+26)>>7,若cij的值小于-32768,则cij的值为-32768,若cij的值大于32767,则cij的值为32767。Exemplarily, if the value of the intra prediction mode is 0~2, or 13~32, or 44~65, and the reference sample on the left outside the current block is "available", then: c ij =Clip3(-32768, 32767, (p ij +2 6 )>>7), i=0~7, j=0~7. p ij is the element of matrix P of 8*8, the calculation method of matrix P is as follows: P=C×S 8 , S 8 is the inverse transformation matrix of 8*8, Clip3(-32768, 32767, (p ij +2 6 ) >>7) means that if the value of c ij is between -32768 and 32767, then the value of c ij is (p ij +2 6 )>>7, if the value of c ij is less than -32768, then the value of c ij is -32768, if the value of c ij is greater than 32767, then the value of c ij is 32767.
示例性的,如果帧内预测模式的值为0~23,或34~57,且当前块外部上边的参考样本“可用”,则:cij=Clip3(-32768,32767,(qij+26)>>7),i=0~7,j=0~7。qij是8×8矩阵Q的元素,矩阵Q的计算方式如下:Q=S8 T×C,S8 T是S8的转置矩阵,S8是8*8逆变换矩阵。Exemplarily, if the value of the intra prediction mode is 0 to 23, or 34 to 57, and the reference sample on the outside of the current block is "available", then: c ij =Clip3(-32768,32767,(q ij +2 6 )>>7), i=0~7, j=0~7. q ij is an element of the 8×8 matrix Q, and the calculation method of the matrix Q is as follows: Q=S 8 T ×C, S 8 T is the transposition matrix of S 8 , and S 8 is the 8*8 inverse transformation matrix.
然后,根据矩阵C修改变换系数矩阵的元素的值:coeffij=cij,i=0~7,j=0~7。Then, modify the values of the elements of the transformation coefficient matrix according to the matrix C: coeff ij =c ij , i=0-7, j=0-7.
然后,对矩阵coeff进行初始逆变换。Then, an initial inverse transformation is performed on the matrix coeff.
情况二、如果当前块的宽度和高度的值均等于8,且二次变换启用标志的值等于1(二次变换启用标志的值等于1,表示序列级或者帧级允许启用二次变换),则对系数矩阵执行以下操作:首先,对变换系数矩阵进行如下垂直反变换,得到矩阵K:kij=Clip3(-32768,32767,(vij+24)>>5),i=0~M1-1,j=0~M2-1,vij是矩阵V的元素,kij是矩阵K的元素。矩阵V的计算如下:V=D8 T×CoeffMatrix,D8 T是反变换矩阵D8的转置矩阵,CoeffMatrix为变换系数。
然后,对矩阵K进行如下水平反变换,得到矩阵H:hij=Clip3(-MaxValue-1,MaxValue,(wij+2shift1-1)>>shift1),i=0~M1-1,j=0~M2-1,wi,j是矩阵W的元素,hij是矩阵H的元素。MaxValue的值为(1<<BitDepth)-1,shift1等于22-BitDepth,矩阵W为:W=K×D8,D8是反变换矩阵。Then, perform the following horizontal inverse transformation on matrix K to obtain matrix H: h ij =Clip3(-MaxValue-1,MaxValue,(w ij +2 shift1-1 )>>shift1), i=0~M 1 -1, j=0 to M 2 -1, w i,j are elements of matrix W, and h ij are elements of matrix H. The value of MaxValue is (1<<BitDepth)-1, shift1 is equal to 22-BitDepth, the matrix W is: W=K×D 8 , and D 8 is an inverse transformation matrix.
当然,上述实施例1-实施例11可以单独实现,也可以组合实现。例如,实施例1和实施例2可以组合实现,实施例3和实施例4可以组合实现,实施例5和实施例6可以组合实现,实施例1和实施例3可以组合实现,实施例1和实施例5可以组合实现,实施例2和实施例4可以组合实现,实施例2和实施例6可以组合实现,实施例3和实施例7可以组合实现,实施例4和实施例7可以组合实现,实施例5和实施例8可以组合实现,实施例6和实施例8可以组合实现,。当然,上述只是几个示例,对此实施例之间的组合方式不做限制。Certainly, the above-mentioned
基于与上述方法同样的申请构思,本申请实施例还提出一种编码装置,应用于编码端,如图5A所示,为所述装置的结构图,所述装置包括:Based on the same application concept as the above method, the embodiment of the present application also proposes an encoding device, which is applied to the encoding end, as shown in Figure 5A, which is a structural diagram of the device, and the device includes:
获取模块511,用于获取当前块对应的残差系数矩阵;An acquisition module 511, configured to acquire a residual coefficient matrix corresponding to the current block;
变换模块512,用于对所述残差系数矩阵进行初始变换,得到初始变换系数矩阵;A transformation module 512, configured to perform an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
确定模块513,用于若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第一预设条件,则确定当前块是否满足第二预设条件;若当前块满足第二预设条件,则根据所述当前块对应的率失真代价值,确定是否对所述当前块进行二次变换;Determining module 513, used to determine whether the current block meets the second preset condition if the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block satisfies the first preset condition; If the block satisfies the second preset condition, determine whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block;
其中,所述第一预设条件包括:所述当前块的预测模式为帧内预测模式;所述第二预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。Wherein, the first preset condition includes: the prediction mode of the current block is an intra-frame prediction mode; the second preset condition includes: the current block uses an intra-frame prediction filtering mode, or does not use an intra-frame prediction mode. Predictive filtering mode.
示例性的,所述确定模块513还用于:若对所述当前块进行二次变换,则对所述初始变换系数矩阵中位于左上角的指定区域的变换系数进行二次变换,得到目标变换系数矩阵;若对所述当前块不进行二次变换,则将所述初始变换系数矩阵确定为目标变换系数矩阵;Exemplarily, the determination module 513 is further configured to: if performing secondary transformation on the current block, perform secondary transformation on the transformation coefficients of the designated area located in the upper left corner in the initial transformation coefficient matrix to obtain the target transformation A coefficient matrix; if no secondary transformation is performed on the current block, the initial transformation coefficient matrix is determined as a target transformation coefficient matrix;
根据所述目标变换系数矩阵进行编码,得到所述当前块的编码比特流。Encoding is performed according to the target transformation coefficient matrix to obtain an encoded bit stream of the current block.
所述确定模块513对所述初始变换系数矩阵中位于左上角的指定区域的变换系数进行二次变换时具体用于:若所述当前块的宽度和高度满足第二尺寸条件,则基于第一指定尺寸的二次变换矩阵,对所述初始变换系数矩阵中位于左上角的第一指定区域的变换系数进行二次变换;若所述当前块的宽度和高度不满足第二尺寸条件,则基于第二指定尺寸的二次变换矩阵,对所述初始变换系数矩阵中位于左上角的第二指定区域的变换系数进行二次变换;The determination module 513 is specifically used for performing secondary transformation on the transformation coefficients of the specified area located in the upper left corner in the initial transformation coefficient matrix: if the width and height of the current block meet the second size condition, then based on the first A secondary transformation matrix of a specified size, which performs a secondary transformation on the transformation coefficients of the first specified area in the upper left corner of the initial transformation coefficient matrix; if the width and height of the current block do not meet the second size condition, then based on A secondary transformation matrix of a second specified size, performing secondary transformation on the transformation coefficients of the second specified area located in the upper left corner of the initial transformation coefficient matrix;
其中,所述第一指定区域的尺寸为第一指定尺寸,所述第二指定区域的尺寸为第二指定尺寸,所述第一指定尺寸大于所述第二指定尺寸。Wherein, the size of the first specified area is a first specified size, the size of the second specified area is a second specified size, and the first specified size is larger than the second specified size.
所述确定模块513还用于:若对所述当前块进行二次变换,则在所述编码比特流中添加第一指示信息;其中,所述第一指示信息用于指示对所述当前块进行二次变换;或者,The determining module 513 is further configured to: add first indication information to the coded bit stream if the current block is to be transformed twice; wherein, the first indication information is used to indicate that the current block perform a secondary transformation; or,
若对所述当前块不进行二次变换,则在所述编码比特流中添加第二指示信息;其中,所述第二指示信息用于指示对所述当前块不进行二次变换。If the second transformation is not performed on the current block, second indication information is added to the coded bit stream; wherein the second indication information is used to indicate that the current block is not to be transformed twice.
所述确定模块513根据所述目标变换系数矩阵进行编码,得到所述当前块的编码比特流时具体用于:根据所述目标变换系数矩阵中的变换系数,确定所述目标变换系数矩阵的目标特征;根据所述目标特征和所述当前块的预设标志位的目标取值,确定是否对所述目标变换系数矩阵进行调整;所述预设标志位的目标取值为第一取值时,用于指示对当前块进行二次变换,所述预设标志位的目标取值为第二取值时,用于指示对当前块不进行二次变换;The determining module 513 performs encoding according to the target transformation coefficient matrix, and when obtaining the coded bit stream of the current block, is specifically used to: determine the target transformation coefficient matrix of the target transformation coefficient matrix according to the transformation coefficients in the target transformation coefficient matrix Features; according to the target feature and the target value of the preset flag bit of the current block, determine whether to adjust the target transform coefficient matrix; when the target value of the preset flag bit is the first value , used to indicate that a second transformation is performed on the current block, and when the target value of the preset flag bit is the second value, it is used to indicate that the current block is not to be transformed twice;
若不对所述目标变换系数矩阵进行调整,则对所述目标变换系数矩阵进行编码,得到所述当前块的编码比特流;若对所述目标变换系数矩阵进行调整,则对所述目标变换系数矩阵中的变换系数进行调整,以使调整后的目标变换系数矩阵的目标特征与所述预设标志位的目标取值相匹配,并对调整后的目标变换系数矩阵进行编码,得到所述当前块的编码比特流。If the target transform coefficient matrix is not adjusted, encode the target transform coefficient matrix to obtain the coded bit stream of the current block; if the target transform coefficient matrix is adjusted, the target transform coefficient matrix The transformation coefficients in the matrix are adjusted so that the target characteristics of the adjusted target transformation coefficient matrix match the target value of the preset flag bit, and the adjusted target transformation coefficient matrix is encoded to obtain the current The encoded bitstream of the block.
基于与上述方法同样的申请构思,本申请实施例还提出一种解码装置,应用于解码端,如图5B所示,为所述装置的结构图,所述装置包括:Based on the same application concept as the above method, the embodiment of the present application also proposes a decoding device, which is applied to the decoding end, as shown in Figure 5B, which is a structural diagram of the device, and the device includes:
获取模块521,用于获取当前块的编码比特流;An acquisition module 521, configured to acquire the coded bitstream of the current block;
确定模块522,用于若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第三预设条件,则确定当前块是否满足第四预设条件;若当前块满足第四预设条件,则根据所述编码比特流中的指示信息或者目标变换系数矩阵确定是否对所述当前块进行二次逆变换;其中,所述第三预设条件包括:所述当前块的预测模式为帧内预测模式;所述第四预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。The determination module 522 is used to determine whether the current block meets the fourth preset condition if the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block satisfies the third preset condition; block satisfies the fourth preset condition, then determine whether to perform a second inverse transform on the current block according to the indication information in the coded bit stream or the target transform coefficient matrix; wherein, the third preset condition includes: the The prediction mode of the current block is an intra prediction mode; the fourth preset condition includes: the current block uses an intra prediction filtering mode, or does not use an intra prediction filtering mode.
所述确定模块522根据所述编码比特流中的指示信息确定是否对所述当前块进行二次逆变换时具体用于:从所述编码比特流中解析出指示信息;若所述指示信息为第一指示信息,则确定对所述当前块进行二次逆变换;其中,所述第一指示信息用于指示对所述当前块进行二次变换;或者,若所述指示信息为第二指示信息,则确定对所述当前块不进行二次逆变换;其中,所述第二指示信息用于指示对所述当前块不进行二次变换。When the determining module 522 determines whether to perform a second inverse transform on the current block according to the indication information in the coded bit stream, it is specifically used to: parse out the indication information from the coded bit stream; if the indication information is The first indication information is to determine to perform a second inverse transformation on the current block; wherein, the first indication information is used to indicate to perform a second transformation on the current block; or, if the indication information is a second indication information, it is determined not to perform secondary inverse transformation on the current block; wherein, the second indication information is used to indicate not to perform secondary transformation on the current block.
所述确定模块522根据所述编码比特流中的目标变换系数矩阵确定是否对所述当前块进行二次逆变换时具体用于:从所述编码比特流中解析出目标变换系数矩阵;When the determining module 522 determines whether to perform a second inverse transform on the current block according to the target transformation coefficient matrix in the coded bitstream, it is specifically used to: parse out the target transformation coefficient matrix from the coded bitstream;
根据所述目标变换系数矩阵中的变换系数,确定所述目标变换系数矩阵的目标特征;determining target features of the target transform coefficient matrix according to transform coefficients in the target transform coefficient matrix;
根据所述目标特征确定所述当前块的预设标志位的目标取值;其中,所述预设标志位的目标取值为第一取值时,用于指示对所述当前块进行二次逆变换,所述预设标志位的目标取值为第二取值时,用于指示对所述当前块不进行二次逆变换;Determine the target value of the preset flag bit of the current block according to the target feature; wherein, when the target value of the preset flag bit is the first value, it is used to indicate that the current block is performed twice Inverse transformation, when the target value of the preset flag bit is the second value, it is used to indicate that the current block is not to be subjected to a second inverse transformation;
根据所述预设标志位的目标取值确定是否对所述当前块进行二次逆变换。Determine whether to perform secondary inverse transformation on the current block according to the target value of the preset flag bit.
所述确定模块522还用于:从所述编码比特流中解析出目标变换系数矩阵;若对所述当前块进行二次逆变换,则对所述目标变换系数矩阵中位于左上角的指定区域的变换系数进行二次逆变换,得到初始变换系数矩阵;若对所述当前块不进行二次逆变换,则将所述目标变换系数矩阵确定为初始变换系数矩阵;对所述初始变换系数矩阵进行初始逆变换,得到所述当前块对应的残差系数矩阵;根据所述残差系数矩阵确定所述当前块的重建值。The determination module 522 is also used to: parse out the target transformation coefficient matrix from the coded bit stream; if the second inverse transformation is performed on the current block, the specified region located in the upper left corner of the target transformation coefficient matrix The transformation coefficients of the transformation coefficients are subjected to a second inverse transformation to obtain an initial transformation coefficient matrix; if the current block is not subjected to a second inverse transformation, the target transformation coefficient matrix is determined as an initial transformation coefficient matrix; the initial transformation coefficient matrix Perform initial inverse transformation to obtain a residual coefficient matrix corresponding to the current block; determine a reconstruction value of the current block according to the residual coefficient matrix.
所述确定模块522对所述目标变换系数矩阵中位于左上角的指定区域的变换系数进行二次逆变换时具体用于:若所述当前块的宽度和高度满足第二尺寸条件,则基于第一指定尺寸的二次逆变换矩阵,对所述目标变换系数矩阵中位于左上角的第一指定区域的变换系数进行二次逆变换;若所述当前块的宽度和高度不满足第二尺寸条件,则基于第二指定尺寸的二次逆变换矩阵,对所述目标变换系数矩阵中位于左上角的第二指定区域的变换系数进行二次逆变换;其中,所述第一指定区域的尺寸为第一指定尺寸,所述第二指定区域的尺寸为第二指定尺寸,所述第一指定尺寸大于所述第二指定尺寸。The determining module 522 is specifically used to perform a second inverse transform on the transform coefficients of the specified region located in the upper left corner in the target transform coefficient matrix: if the width and height of the current block meet the second size condition, then based on the second size condition A secondary inverse transformation matrix of a specified size, performing a secondary inverse transformation on the transformation coefficients of the first specified area in the upper left corner of the target transformation coefficient matrix; if the width and height of the current block do not meet the second size condition , then based on the secondary inverse transformation matrix of the second specified size, perform a secondary inverse transformation on the transformation coefficients of the second specified region located in the upper left corner of the target transformation coefficient matrix; wherein, the size of the first specified region is A first specified size, the size of the second specified area is a second specified size, and the first specified size is larger than the second specified size.
本申请实施例提供的编码端设备(示例性的,编码端设备可以是视频编码器),从硬件层面而言,其硬件架构示意图具体可以参见图6A所示。包括:处理器611和机器可读存储介质612,所述机器可读存储介质612存储有能够被所述处理器611执行的机器可执行指令;所述处理器611用于执行机器可执行指令,以实现本申请上述示例公开的方法。例如,处理器用于执行机器可执行指令,以实现如下步骤:获取当前块对应的残差系数矩阵;The encoding end device provided by the embodiment of the present application (for example, the encoding end device may be a video encoder), in terms of hardware level, its hardware architecture schematic diagram can refer to FIG. 6A for details. Including: a
对所述残差系数矩阵进行初始变换,得到初始变换系数矩阵;performing an initial transformation on the residual coefficient matrix to obtain an initial transformation coefficient matrix;
若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第一预设条件,则确定当前块是否满足第二预设条件;若当前块满足第二预设条件,则根据所述当前块对应的率失真代价值,确定是否对所述当前块进行二次变换;If the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block satisfies the first preset condition, then determine whether the current block satisfies the second preset condition; if the current block satisfies the second preset condition condition, then determine whether to perform secondary transformation on the current block according to the rate-distortion cost value corresponding to the current block;
其中,所述第一预设条件包括:所述当前块的预测模式为帧内预测模式;所述第二预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。Wherein, the first preset condition includes: the prediction mode of the current block is an intra-frame prediction mode; the second preset condition includes: the current block uses an intra-frame prediction filtering mode, or does not use an intra-frame prediction mode. Predictive filtering mode.
本申请实施例提供的解码端设备(示例性的,解码端设备可以是视频解码器),从硬件层面而言,其硬件架构示意图具体可以参见图6B所示。包括:处理器621和机器可读存储介质622,所述机器可读存储介质622存储有能够被所述处理器621执行的机器可执行指令;所述处理器621用于执行机器可执行指令,以实现本申请上述示例公开的方法。例如,处理器用于执行机器可执行指令,以实现如下步骤:获取当前块的编码比特流;The decoding end device provided by the embodiment of the present application (for example, the decoding end device may be a video decoder), in terms of hardware level, its hardware architecture schematic diagram can be specifically referred to as shown in FIG. 6B . Including: a
若当前块支持二次变换,当前块支持可选择的二次变换AST技术,且当前块满足第三预设条件,则确定当前块是否满足第四预设条件;若当前块满足第四预设条件,则根据所述编码比特流中的指示信息或者目标变换系数矩阵确定是否对所述当前块进行二次逆变换;If the current block supports secondary transformation, the current block supports the optional secondary transformation AST technology, and the current block meets the third preset condition, then determine whether the current block meets the fourth preset condition; if the current block meets the fourth preset condition condition, then determine whether to perform a second inverse transform on the current block according to the indication information in the coded bit stream or the target transform coefficient matrix;
其中,所述第三预设条件包括:所述当前块的预测模式为帧内预测模式;所述第四预设条件包括:所述当前块使用帧内预测滤波模式,或者,不使用帧内预测滤波模式。Wherein, the third preset condition includes: the prediction mode of the current block is an intra-frame prediction mode; the fourth preset condition includes: the current block uses an intra-frame prediction filtering mode, or does not use an intra-frame prediction mode. Predictive filtering mode.
基于与上述方法同样的申请构思,本申请实施例中还提供一种摄像机设备,该摄像机设备可以包括上述任一实施例中的编码装置和/或解码装置。Based on the same application concept as the above method, an embodiment of the present application further provides a camera device, and the camera device may include the encoding device and/or the decoding device in any of the above embodiments.
基于与上述方法同样的申请构思,本申请实施例还提供一种机器可读存储介质,所述机器可读存储介质上存储有若干计算机指令,所述计算机指令被处理器执行时,能够实现本申请上述示例公开的编解码方法。其中,上述机器可读存储介质可以是任何电子、磁性、光学或其它物理存储装置,可以包含或存储信息,如可执行指令、数据,等等。例如,机器可读存储介质可以是:RAM(Radom Access Memory,随机存取存储器)、易失存储器、非易失性存储器、闪存、存储驱动器(如硬盘驱动器)、固态硬盘、任何类型的存储盘(如光盘、dvd等),或者类似的存储介质,或者它们的组合。Based on the same application idea as the above-mentioned method, the embodiment of the present application also provides a machine-readable storage medium, on which several computer instructions are stored, and when the computer instructions are executed by a processor, the present invention can be realized. Apply the codec method disclosed in the above example. Wherein, the above-mentioned machine-readable storage medium may be any electronic, magnetic, optical or other physical storage device, which may contain or store information, such as executable instructions, data, and so on. For example, the machine-readable storage medium can be: RAM (Radom Access Memory, random access memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid-state hard disk, any type of storage disk (such as CD, DVD, etc.), or similar storage media, or a combination of them.
上述实施例阐明的系统、装置、模块或单元,可以由计算机芯片或实体实现,或由具有某种功能的产品来实现。一种典型的实现为计算机,计算机的形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。The systems, devices, modules or units described in the above embodiments may be realized by computer chips or entities, or by products with certain functions. A typical implementation is a computer, which may be in the form of a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, e-mail device, tablet computer, A wearable device or a combination of any of these devices.
为了描述的方便,描述以上装置时以功能分为各种单元分别描述。当然,在实施本申请时可以把各单元的功能在同一个或多个软件和/或硬件中实现。For the convenience of description, when describing the above devices, functions are divided into various units and described separately. Of course, when implementing the present application, the functions of each unit can be implemented in one or more pieces of software and/or hardware.
以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。The above descriptions are only examples of the present application, and are not intended to limit the present application. For those skilled in the art, various modifications and changes may occur in this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.
Claims (16)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010239734.0A CN113473129B (en) | 2020-03-30 | 2020-03-30 | An encoding and decoding method and device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010239734.0A CN113473129B (en) | 2020-03-30 | 2020-03-30 | An encoding and decoding method and device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN113473129A CN113473129A (en) | 2021-10-01 |
| CN113473129B true CN113473129B (en) | 2022-12-23 |
Family
ID=77865068
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010239734.0A Active CN113473129B (en) | 2020-03-30 | 2020-03-30 | An encoding and decoding method and device |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN113473129B (en) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115499647B (en) * | 2022-09-20 | 2025-07-04 | 阿里巴巴(中国)有限公司 | Multi-transformation kernel selection method, encoding and decoding method, electronic device and storage medium |
| CN118379177B (en) * | 2024-05-08 | 2025-05-02 | 北京国隐科技有限公司 | A method and device for processing and extracting image watermark information |
| CN119788478B (en) * | 2024-12-23 | 2026-02-06 | 湖北思朗通信科技有限公司 | Signal processing methods, apparatus, computer equipment and storage media |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108712650A (en) * | 2012-06-29 | 2018-10-26 | 韩国电子通信研究院 | Video encoding/decoding method, method for video coding and computer-readable medium |
| CN109076226A (en) * | 2016-05-13 | 2018-12-21 | 索尼公司 | Image processing apparatus and method |
| CN109644276A (en) * | 2016-08-01 | 2019-04-16 | 韩国电子通信研究院 | image encoding/decoding method |
| CN110326294A (en) * | 2017-01-03 | 2019-10-11 | Lg电子株式会社 | Use the method and apparatus of quadratic transformation encoding/decoding video signal |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US9378185B2 (en) * | 2010-09-30 | 2016-06-28 | Texas Instruments Incorporated | Transform and quantization architecture for video coding and decoding |
-
2020
- 2020-03-30 CN CN202010239734.0A patent/CN113473129B/en active Active
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108712650A (en) * | 2012-06-29 | 2018-10-26 | 韩国电子通信研究院 | Video encoding/decoding method, method for video coding and computer-readable medium |
| CN109076226A (en) * | 2016-05-13 | 2018-12-21 | 索尼公司 | Image processing apparatus and method |
| CN109644276A (en) * | 2016-08-01 | 2019-04-16 | 韩国电子通信研究院 | image encoding/decoding method |
| CN110326294A (en) * | 2017-01-03 | 2019-10-11 | Lg电子株式会社 | Use the method and apparatus of quadratic transformation encoding/decoding video signal |
Also Published As
| Publication number | Publication date |
|---|---|
| CN113473129A (en) | 2021-10-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN105791872B (en) | The image processing apparatus and method of intra prediction are executed in HEVC coding and decoding video | |
| US9872019B2 (en) | Method and device for deblocking-filtering, and method and device for encoding and decoding using same | |
| WO2021203394A1 (en) | Loop filtering method and apparatus | |
| AU2019298855A1 (en) | Apparatus and method for filtering in video coding | |
| SG191267A1 (en) | Enhanced intra-prediction coding using planar representations | |
| JP7467687B2 (en) | Encoding/Decoding Method and Apparatus | |
| CN103109530A (en) | Method and apparatus for encoding video using adjustable loop filtering, and method and apparatus for decoding video using adjustable loop filtering | |
| TW202315408A (en) | Block-based prediction | |
| CN113473129B (en) | An encoding and decoding method and device | |
| CN101707716B (en) | Video coder and coding method | |
| WO2022178686A1 (en) | Encoding/decoding method, encoding/decoding device, encoding/decoding system, and computer readable storage medium | |
| KR20120117613A (en) | Method and apparatus for encoding a moving picture | |
| TWI806447B (en) | Encoding and decoding method, encoding and decoding apparatus, and devices thereof | |
| KR20120010177A (en) | Deblocking filtering method and apparatus, method and apparatus for encoding and decoding using deblocking filtering | |
| CN105357538B (en) | Adaptive loop filtering method and apparatus | |
| CN111988618B (en) | Decoding and encoding method, decoding end and encoding end | |
| CN113709480B (en) | Encoding and decoding method, device and equipment | |
| CN114979655B (en) | Video encoding and decoding method, device, computer readable medium and electronic device | |
| CN112911312B (en) | Encoding and decoding method, device and equipment | |
| CN116095310A (en) | Image encoding and decoding method and device, electronic equipment and storage medium | |
| HK40065929A (en) | Coding and decoding method, device and equipment thereof | |
| HK40065929B (en) | Coding and decoding method, device and equipment thereof | |
| RU2827777C2 (en) | Method, equipment and devices for encoding and decoding | |
| TW202406350A (en) | Unified cross-component model derivation | |
| WO2025043408A1 (en) | Encoding method, decoding method, code stream, encoder, decoder, and storage medium |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant |




