CN102857755B - The method and apparatus determining transform block size - Google Patents
The method and apparatus determining transform block size Download PDFInfo
- Publication number
- CN102857755B CN102857755B CN201210019911.XA CN201210019911A CN102857755B CN 102857755 B CN102857755 B CN 102857755B CN 201210019911 A CN201210019911 A CN 201210019911A CN 102857755 B CN102857755 B CN 102857755B
- Authority
- CN
- China
- Prior art keywords
- block
- size
- image
- transform
- transformation
- 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
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/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/119—Adaptive subdivision aspects, e.g. subdivision of a picture into rectangular or non-rectangular coding blocks
-
- 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/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/12—Selection from among a plurality of transforms or standards, e.g. selection between discrete cosine transform [DCT] and sub-band transform or selection between H.263 and H.264
- H04N19/122—Selection of transform size, e.g. 8x8 or 2x4x8 DCT; Selection of sub-band transforms of varying structure or type
-
- 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/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/176—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
-
- 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/60—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
-
- 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/60—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
- H04N19/61—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding in combination with predictive coding
-
- 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/96—Tree coding, e.g. quad-tree 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
Description
技术领域technical field
本发明涉及通信技术领域,特别涉及确定变换块尺寸的方法和设备。The invention relates to the field of communication technology, in particular to a method and device for determining the size of a transformation block.
背景技术Background technique
为了尽量减少传送视频数据所需要的带宽,可以采用多种视频压缩方法对视频数据进行压缩,其中视频压缩方法包括:帧内压缩和帧间压缩。现在多采用基于运动估计的帧间压缩方法。具体的,图像的编码端采用帧间压缩方法对图像压缩并编码的过程包括:编码端将待编码图像块划分成若干个大小相等的子图像块,然后针对每个子图像块,在参考图像中搜索与当前子图像块最匹配的图像块作为预测块,然后将该子图像块与预测块的相应像素值相减得到残差,并将该残差经变换与量化后得到的值进行熵编码,最后将熵编码得到的比特流和运动矢量信息一并发给解码端,其中,运动矢量信息表示当前子图像块与预测块的位置差。在图像的解码端,首先获得熵编码比特流后进行熵解码,得到相应的残差,以及相应的运动矢量信息;然后根据运动矢量信息在参考图像中获得相应的匹配图像块(即上述预测块),再根据匹配图像块中各像素点的值和残差值中对应像素点的值相加得到当前子图像块中各像素点的值。帧内预测是指利用本幅图像内的信息对图像块进行预测得到预测块,编码端根据预测模式、预测方向、图像块周围的像素值得到预测块对应的像素,将图像块像素与预测块像素相减得到残差,残差经变换、量化和熵编码后写入码流中;解码端解析码流,对码流进行熵解码、反量化、反变换后得到残差块,解码端根据预测模式、预测方向、图像块周围的像素值得到预测块,将残差块像素与预测块像素相加得到重构图像块。In order to minimize the bandwidth required to transmit video data, multiple video compression methods can be used to compress video data, wherein the video compression methods include: intra-frame compression and inter-frame compression. Nowadays, inter-frame compression methods based on motion estimation are mostly used. Specifically, the process of image compression and encoding by the image encoding end using the inter-frame compression method includes: the encoding end divides the image block to be encoded into several sub-image blocks of equal size, and then for each sub-image block, in the reference image Search for the image block that best matches the current sub-image block as the prediction block, then subtract the sub-image block from the corresponding pixel value of the prediction block to obtain a residual, and perform entropy coding on the value obtained by transforming and quantizing the residual , and finally send the bit stream and motion vector information obtained by entropy encoding to the decoding end, wherein the motion vector information represents the position difference between the current sub-image block and the prediction block. At the decoding end of the image, first obtain the entropy coded bit stream and perform entropy decoding to obtain the corresponding residual and the corresponding motion vector information; then obtain the corresponding matching image block (that is, the above-mentioned prediction block) in the reference image according to the motion vector information ), and then add the value of each pixel in the matching image block to the value of the corresponding pixel in the residual value to obtain the value of each pixel in the current sub-image block. Intra-frame prediction refers to using the information in the image to predict the image block to obtain the prediction block. The encoding end obtains the corresponding pixels of the prediction block according to the prediction mode, prediction direction, and pixel values around the image block, and compares the pixels of the image block with the prediction block The pixel is subtracted to obtain the residual, and the residual is written into the code stream after transformation, quantization and entropy coding; the decoding end parses the code stream, performs entropy decoding, inverse quantization, and inverse transformation on the code stream to obtain a residual block, and the decoding end according to The prediction mode, prediction direction, and pixel values around the image block are used to obtain a prediction block, and the pixels of the residual block and the prediction block are added to obtain a reconstructed image block.
在现在的视频编解码标准中存在编码单元(coding unit)、预测单元(predictionunit)和变换单元(transform unit)的概念。其中,编码单元是在编码端或解码端进行编码或解码时操作的图像块。预测单元是编码单元中具有独立预测模式的图像块。预测块是编码单元进行预测操作的图像块,一个预测单元中可能包含多个预测块。变换单元是编码单元中进行变换操作的 图像块,此时的图像块也可称为变换块。考虑到预测块内部差值信号的相关性较强,而大块变换比小块变换能量集中性能更高。更广义的,一个图像块可包含一个或多个预测块,在编解码端以预测块为单位进行预测;同时,一个图像块包含一个或多个变换块,在编解码端以变换块为单位进行变换。In current video codec standards, there are concepts of coding unit, prediction unit and transform unit. Wherein, the coding unit is an image block that is operated when coding or decoding is performed at the coding end or the decoding end. A prediction unit is an image block with an independent prediction mode in a coding unit. A prediction block is an image block on which a coding unit performs a prediction operation, and one prediction unit may contain multiple prediction blocks. A transformation unit is an image block that undergoes transformation operations in a coding unit, and the image block at this time may also be called a transformation block. Considering that the correlation of the internal difference signal of the prediction block is strong, the energy concentration performance of large block transformation is higher than that of small block transformation. In a more general sense, an image block can contain one or more predictive blocks, which are predicted in units of predictive blocks at the codec end; at the same time, an image block contains one or more transform blocks, and are predicted in units of transform blocks at the codec end Make a transformation.
在现有的视频编解码标准中,如移动图像专家组(Moving Picture ExpertsGroup,MPEG),H.264/AVC(Advanced Video Coding,增强视频编码),一个图像块,或称为宏块(macroblock)、超宏块(super-macroblock)等,被划分为若干子图像块,这些子图像块的尺寸可为64×64、64×32、32×64、32×32、32×16、16×32、16×16、16×8、8×16、8×8、8×4、4×8、4×4等,子图像块以这些尺寸进行上述的运动估计和运动补偿,图像的编码端需要将标识图像块划分方式的码字发送给图像的解码端,以便图像的解码端获知图像编码端的划分方式,并根据该划分方式和运动矢量信息,确定相应的预测块。在现有的视频编解码标准中这些子图像块均为N×M(N和M均为大于0的整数)的矩形块,并且N和M具有倍数关系。In existing video codec standards, such as Moving Picture Experts Group (MPEG), H.264/AVC (Advanced Video Coding, Enhanced Video Coding), an image block, or macroblock (macroblock) , super-macroblock (super-macroblock), etc., are divided into several sub-image blocks, and the size of these sub-image blocks can be 64×64, 64×32, 32×64, 32×32, 32×16, 16×32 , 16×16, 16×8, 8×16, 8×8, 8×4, 4×8, 4×4, etc., sub-image blocks perform the above-mentioned motion estimation and motion compensation with these sizes, and the encoding side of the image needs The code word identifying the division method of the image block is sent to the decoder of the image, so that the decoder of the image can know the division method of the image encoder, and determine the corresponding prediction block according to the division method and motion vector information. In the existing video codec standard, these sub-image blocks are rectangular blocks of N×M (both N and M are integers greater than 0), and N and M have a multiple relationship.
在现有的视频编码和解码技术中,可以使用变换矩阵去除图像块的残差的相关性,即去除图像块的冗余信息,以便提高编码效率,图像块中的数据块的变换通常采用二维变换,即在编码端将数据块的残差信息分别与一个N×M的变换矩阵及其转置矩阵相乘,相乘之后得到的是变换系数。上述步骤可以使用以下公式描述:In the existing video coding and decoding technology, the transformation matrix can be used to remove the residual correlation of the image block, that is, to remove the redundant information of the image block, so as to improve the coding efficiency. The transformation of the data block in the image block usually adopts two Dimensional transformation, that is, the residual information of the data block is multiplied by an N×M transformation matrix and its transpose matrix at the encoding end, and the transformation coefficients are obtained after the multiplication. The above steps can be described using the following formula:
f=T′×C×Tf=T'×C×T
其中,C代表数据块的残差信息,T和T′代表变换矩阵和变换矩阵的转置矩阵,f代表数据块的残差信息经变换后得到的变换系数矩阵。其中,变换矩阵可以是离散余弦变换(Discrete Cosine Transform,DCT)矩阵,整数变换(Integer Transform)矩阵、KL变换(Karhunen Lòeve Transform,KLT)矩阵等。其中,KLT可以更好的考虑图像块或图像块残差的纹理信息,因此使用KLT可以达到较好的效果。Wherein, C represents the residual information of the data block, T and T' represent the transformation matrix and the transpose matrix of the transformation matrix, and f represents the transformation coefficient matrix obtained after the transformation of the residual information of the data block. Wherein, the transformation matrix may be a discrete cosine transform (Discrete Cosine Transform, DCT) matrix, an integer transform (Integer Transform) matrix, a KL transform (Karhunen Lòeve Transform, KLT) matrix, and the like. Among them, KLT can better consider the texture information of image blocks or image block residuals, so using KLT can achieve better results.
对图像块的残差信息进行上述处理相当于将图像块的残差信息从空域转换至频域,且经处理后得到的变换系数矩阵f集中于低频区域;编码端对图像块的残差信息进行上述变换之后,对变换后得到的变换系数矩阵再进行量化、熵编码等处理后,将熵编码得到的比特流发送给解码端。为了使解码端知道编码端所采用的变换矩阵类型和尺寸,通常,编码端会将表示当前图像 块所使用的变换矩阵的指示信息发送给解码端。Performing the above processing on the residual information of the image block is equivalent to converting the residual information of the image block from the spatial domain to the frequency domain, and the transformation coefficient matrix f obtained after processing is concentrated in the low-frequency region; After the above transformation is performed, quantization, entropy coding and other processing are performed on the transformation coefficient matrix obtained after transformation, and the bit stream obtained by entropy coding is sent to the decoding end. In order for the decoding end to know the type and size of the transformation matrix used by the encoding end, usually, the encoding end will send the indication information indicating the transformation matrix used by the current image block to the decoding end.
后续解码端根据上述指示信息确定编码端采用的变换矩阵,根据变换矩阵的特点(变换矩阵的正交性等),对编码端发送的比特流进行解码得到变换系数矩阵,将变换系数矩阵与变换矩阵及其转置矩阵相乘,可恢复得到与编码端近似一致的数据块的残差信息。上述步骤可以使用以下公式描述:The subsequent decoding end determines the transformation matrix used by the encoding end according to the above indication information, and according to the characteristics of the transformation matrix (orthogonality of the transformation matrix, etc.), decodes the bit stream sent by the encoding end to obtain the transformation coefficient matrix, and combines the transformation coefficient matrix with the transformation matrix By multiplying the matrix and its transposed matrix, the residual information of the data block that is approximately consistent with the encoding end can be recovered. The above steps can be described using the following formula:
C=T×f×T′C=T×f×T′
其中,C代表数据块的残差信息,T和T′代表变换矩阵和变换矩阵的转置矩阵,f代表解码端得到的变换系数矩阵。Wherein, C represents the residual information of the data block, T and T′ represent the transformation matrix and the transpose matrix of the transformation matrix, and f represents the transformation coefficient matrix obtained by the decoding end.
由于图像块的残差可能存在不同的分布规律,使用某一特定尺寸的变换矩阵往往达不到好的变换效果,因此,现有技术中会尝试对图像块的残差使用不同尺寸的变换矩阵(也称为变换块)。因此,对于一个2N×2N的图像块可以使用尺寸为2N×2N的变换矩阵,也可以使用尺寸为N×N的变换矩阵、或尺寸为0.5N×0.5N的变换矩阵。Since the residuals of image blocks may have different distribution rules, using a transformation matrix of a certain size often fails to achieve a good transformation effect. Therefore, in the prior art, attempts are made to use transformation matrices of different sizes for the residuals of image blocks (also known as a transform block). Therefore, for a 2N×2N image block, a transformation matrix with a size of 2N×2N may be used, or a transformation matrix with a size of N×N, or a transformation matrix with a size of 0.5N×0.5N may be used.
但是,目前仅采用方形尺寸的变换矩阵,对于频繁出现的条状纹理,方形尺寸的变换矩阵不能有效地去除图像块的冗余信息,降低了图像压缩效率。However, at present, only the transformation matrix of square size is used. For the frequently appearing strip texture, the transformation matrix of square size cannot effectively remove the redundant information of the image block, which reduces the image compression efficiency.
发明内容Contents of the invention
本发明实施例提供一种确定变换块尺寸的方法和设备,能够提高图像压缩效率。Embodiments of the present invention provide a method and device for determining a transformation block size, which can improve image compression efficiency.
一方面,提供了一种确定变换块尺寸的方法,包括:根据图像块信息和图像块的划分方式,获得图像块对应的变换块的参数;根据变换块的参数和图像块的划分方式,获得变换块尺寸。On the one hand, a method for determining the size of a transformation block is provided, including: obtaining the parameters of the transformation block corresponding to the image block according to the image block information and the division method of the image block; according to the parameters of the transformation block and the division method of the image block, obtaining Transform block size.
另一方面,提供了一种图像编码方法,包括:根据图像块对应的变换块的参数,获得至少一个候选变换块尺寸;确定至少一个候选变换块尺寸的编号;选择候选变换块尺寸之一,作为图像块对应的变换块的尺寸。In another aspect, an image coding method is provided, including: obtaining at least one candidate transform block size according to parameters of a transform block corresponding to the image block; determining the number of at least one candidate transform block size; selecting one of the candidate transform block sizes, As the size of the transform block corresponding to the image block.
另一方面,提供了一种图像解码方法,包括:根据图像块对应的变换块的参数,获得至少一个候选变换块尺寸;确定至少一个候选变换块尺寸的编号;获得变换块的变换块尺寸的编号;根据变换块尺寸的编号获得变换块尺寸。On the other hand, an image decoding method is provided, including: obtaining at least one candidate transform block size according to the parameters of the transform block corresponding to the image block; determining the serial number of at least one candidate transform block size; obtaining the transform block size of the transform block Number; obtain the transformation block size according to the number of the transformation block size.
另一方面,提供了一种确定变换块尺寸的设备,包括:参数获取单元,用于根据图像块信息和图像块的划分方式,获得图像块对应的变换块的参数;尺寸获取单元,用于根据变换块的参数和图像块的划分方式,获得变换块尺寸。In another aspect, a device for determining the size of a transformation block is provided, including: a parameter acquisition unit, configured to obtain parameters of a transformation block corresponding to the image block according to image block information and a division method of the image block; a size acquisition unit, configured to The size of the transform block is obtained according to the parameters of the transform block and the division manner of the image block.
另一方面,提供了一种图像编码设备,包括:获取单元,用于根据图像块对应的变换块的参数,获得至少一个候选变换块尺寸;确定单元,用于确定至少一个候选变换块尺寸的编号;编码单元,用于选择候选变换块尺寸之一,作为图像块对应的变换块的尺寸,并编码变换块的尺寸的编号。In another aspect, an image coding device is provided, including: an obtaining unit, configured to obtain at least one candidate transform block size according to a parameter of a transform block corresponding to the image block; a determining unit, configured to determine the size of at least one candidate transform block number; the coding unit is used to select one of the candidate transform block sizes as the size of the transform block corresponding to the image block, and encode the number of the size of the transform block.
另一方面,提供了一种图像解码设备,包括:获取单元,用于根据图像块对应的变换块的参数,获得至少一个候选变换块尺寸;确定单元,用于确定至少一个候选变换块尺寸的编号;解码单元,用于获得变换块的变换块尺寸的编号,并根据变换块尺寸的编号获得变换块尺寸。In another aspect, an image decoding device is provided, including: an obtaining unit, configured to obtain at least one candidate transform block size according to a parameter of a transform block corresponding to the image block; a determining unit, configured to determine the size of at least one candidate transform block number; a decoding unit configured to obtain the number of the transform block size of the transform block, and obtain the transform block size according to the number of the transform block size.
本发明实施例在确定变换块尺寸时,根据图像块对应的变换块的参数和图像块的划分方式,获得变换块尺寸,因此能够采用适应图像块的划分方式的变换块,提高了图像压缩效率。In the embodiment of the present invention, when determining the size of the transformation block, the size of the transformation block is obtained according to the parameters of the transformation block corresponding to the image block and the division method of the image block, so the transformation block suitable for the division method of the image block can be used, and the image compression efficiency is improved. .
附图说明Description of drawings
为了更清楚地说明本发明实施例的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some of the present invention. Embodiments, for those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1a-图1d是图像块的对称划分方式的例子的示意图。1a-1d are schematic diagrams of examples of symmetrical division methods of image blocks.
图2a-图2d是图像块的非对称划分方式的例子的示意图。2a-2d are schematic diagrams of examples of asymmetric division of image blocks.
图3a-图3c是对应不同层数的变换块的示意图。3a-3c are schematic diagrams of transform blocks corresponding to different layers.
图4a-图4d是根据预测块类型确定变换块尺寸的示意图。Fig. 4a-Fig. 4d are schematic diagrams of determining the transform block size according to the prediction block type.
图5是根据本发明一个实施例的确定变换块尺寸的方法的流程图。Fig. 5 is a flowchart of a method for determining a transform block size according to an embodiment of the present invention.
图6a和图6b是本发明一个实施例的变换块的示意图。Fig. 6a and Fig. 6b are schematic diagrams of transform blocks according to an embodiment of the present invention.
图7a-7d是本发明实施例的变换块的示意图。7a-7d are schematic diagrams of transform blocks according to embodiments of the present invention.
图8是根据本发明一个实施例的图像编码方法的流程图。Fig. 8 is a flowchart of an image coding method according to an embodiment of the present invention.
图9是根据本发明一个实施例的图像解码方法的流程图。Fig. 9 is a flowchart of an image decoding method according to an embodiment of the present invention.
图10是本发明实施例的确定变换块尺寸的设备的框图。Fig. 10 is a block diagram of an apparatus for determining a transform block size according to an embodiment of the present invention.
图11是本发明一个实施例的图像编码设备的框图。Fig. 11 is a block diagram of an image encoding device of one embodiment of the present invention.
图12是本发明一个实施例的图像解码设备的框图Fig. 12 is a block diagram of an image decoding device according to an embodiment of the present invention
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some of the embodiments of the present invention, but not all of them. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
图1a-图1d是图像块的对称划分方式的例子的示意图。1a-1d are schematic diagrams of examples of symmetrical division methods of image blocks.
图像块被划分成子图像块的常用方式有:2N×2N划分方式,图像块只包含一个子图像块,即该图像块不被划分成更小的子图像块,如图1a所示;2N×N划分方式,将图像块划分成上下两个等大的子图像块,如图1b所示;N×2N划分方式,将图像块划分成左右两个等大的子图像块,如图1c所示;N×N划分方式,将图像块划分成四个等大的子图像块,如图1d所示。上述N为任意正整数,表示像素数目。The commonly used ways to divide an image block into sub-image blocks are: 2N×2N division method, the image block only contains one sub-image block, that is, the image block is not divided into smaller sub-image blocks, as shown in Figure 1a; 2N×2N The N division method divides the image block into two sub-image blocks of equal size, as shown in Figure 1b; the N×2N division method divides the image block into two sub-image blocks of equal size on the left and right, as shown in Figure 1c Shown; N×N division method, the image block is divided into four sub-image blocks of equal size, as shown in Figure 1d. The above N is any positive integer, representing the number of pixels.
图2a-图2d是图像块的非对称划分方式的例子的示意图。2a-2d are schematic diagrams of examples of asymmetric division of image blocks.
图像块还可以采用非对称划分方式,如图2a至图2d所示。图2a和2b所示划分方式将一个图像块划分成上下两个不等大的矩形子图像块,图2a所示2N×nU(图中n=0.5N)划分出的两个子图像块中,上边子图像块两条变长为2N和0.5N,下边子图像块两条变长为2N和1.5N。一般而言,2N×nU中的U表示图像划分线相对该图像块的垂直平分线上移,2N×nU表示图像划分线相对该图像块的垂直平分线上移n,其中,n=x×N,其中x大于或等于0并小于或者等于1。The image blocks may also be divided in an asymmetric manner, as shown in Fig. 2a to Fig. 2d. The division method shown in Figure 2a and 2b divides an image block into two unequal rectangular sub-image blocks up and down, in the two sub-image blocks divided by 2N*nU (n=0.5N in the figure) shown in Figure 2a, The lengths of the two upper sub-image blocks are 2N and 0.5N, and the lengths of the two lower sub-image blocks are 2N and 1.5N. Generally speaking, U in 2N×nU indicates that the image dividing line moves relative to the vertical bisector of the image block, and 2N×nU indicates that the image dividing line moves n relative to the vertical bisector of the image block, where n=x× N, where x is greater than or equal to 0 and less than or equal to 1.
图2b所示2N×nD(图中n=0.5N)划分出的两个子图像块中,上边子图像块两条变长为2N和1.5N,下边子图像块两条变长为2N和0.5N。一般而言,2N×nD中的D表示图像划分线相对该图像块的垂直平分线下移,2N×nD表示图像划分线相对该图像块的垂直平分线下移n,n=x×N,其中x大于或等于0并小于或者等于1。Among the two sub-image blocks divided by 2N×nD (n=0.5N in the figure) shown in Figure 2b, the two sub-image blocks on the upper side become 2N and 1.5N in length, and the two sub-image blocks on the lower side become 2N and 0.5N in length N. Generally speaking, D in 2N×nD means that the image dividing line moves down relative to the vertical bisector of the image block, and 2N×nD means that the image dividing line moves down by n relative to the vertical bisector of the image block, n=x×N, where x is greater than or equal to 0 and less than or equal to 1.
图2c和2d所示划分方式将一个图像块划分成左右两个不等大的矩形子图像块,图2c所示nL×2N(图中n=0.5N)划分出的两个子图像块中,左边子图像块两条变长为0.5N和2N,右边子图像块两条变长为1.5N和2N。一般而言,nL×2N中的L表示图像划分线相对该图像块的垂直平分线左移,nL×2N表示表示图像划分线相对该图像块的垂直平分线左移n,其中,n=x×N, 其中x大于或等于0并小于或者等于1。The division methods shown in Figures 2c and 2d divide an image block into two unequal rectangular sub-image blocks on the left and right, in the two sub-image blocks divided by nL*2N (n=0.5N in the figure) shown in Figure 2c, The lengths of the two sub-image blocks on the left are 0.5N and 2N, and the lengths of the two sub-image blocks on the right are 1.5N and 2N. Generally speaking, L in nL×2N means that the image dividing line moves left relative to the vertical bisector of the image block, and nL×2N means that the image dividing line moves left by n relative to the vertical bisector of the image block, where n=x ×N, where x is greater than or equal to 0 and less than or equal to 1.
图2d所示nR×2N(图中n=0.5N;)划分出的两个子图像块中,左边子图像块两条变长为1.5N和2N,右边子图像块两条变长为0.5N和2N。一般而言,nR×2N中的R表示图像划分线相对该图像块的垂直平分线右移,nR×2N表示表示图像划分线相对该图像块的垂直平分线右移n,其中,n=x×N,其中x大于或等于0并小于或者等于1。Among the two sub-image blocks divided by nR×2N (n=0.5N in the figure;) shown in Fig. 2d, the lengths of the two sub-image blocks on the left are 1.5N and 2N, and the lengths of the two sub-image blocks on the right are 0.5N and 2N. Generally speaking, R in nR×2N means that the image dividing line moves right relative to the vertical bisector of the image block, and nR×2N means that the image dividing line moves right by n relative to the vertical bisector of the image block, where n=x ×N, where x is greater than or equal to 0 and less than or equal to 1.
上述图像块的划分方式也可以使用预测块类型进行指代。2N×2N、2N×N、N×2N、2N×nU、2N×nD、nL×2N、nR×2N均表示图像块划分方式对应的预测块类型。The foregoing manner of dividing an image block may also be referred to by a prediction block type. 2N×2N, 2N×N, N×2N, 2N×nU, 2N×nD, nL×2N, and nR×2N all represent prediction block types corresponding to image block division methods.
为了有效地表示图像块如何使用不同尺寸的变换矩阵,可以使用树形标识方法,逐层标识变换块。图3a-图3c是对应不同层数的变换块的示意图。In order to effectively represent how image blocks use transformation matrices of different sizes, a tree identification method can be used to identify transformation blocks layer by layer. 3a-3c are schematic diagrams of transform blocks corresponding to different layers.
如图3a-图3c所示,当标识图像块使用的变换块尺寸时,码流中第零层有用于标识图像块是否使用尺寸为2N×2N变换矩阵的指示位,如果图像块使用尺寸为2N×2N变换矩阵(如图3a所示),则该指示位为0。如果图像块不使用2N×2N变换时,则该指示位为1,表示需要将尺寸为2N×2N变换矩阵进一步划分成四个尺寸为N×N的变换矩阵,并在码流第一层结构中用4个比特分别标识每一个尺寸为N×N的变换矩阵是否进一步划分。如果图像块使用如图3b所示的变换结构时,4个比特都为0,表示每一个尺寸为N×N的变换矩阵不再进一步划分。As shown in Figure 3a-Figure 3c, when identifying the transformation block size used by the image block, the zeroth layer in the code stream has an indicator bit for identifying whether the image block uses a transformation matrix with a size of 2N×2N, if the image block uses a size of 2N×2N transformation matrix (as shown in FIG. 3 a ), the indicator bit is 0. If the image block does not use 2N×2N transformation, the indicator bit is 1, indicating that the transformation matrix with a size of 2N×2N needs to be further divided into four transformation matrices with a size of N×N, and in the first layer structure of the code stream In , 4 bits are used to respectively identify whether each transformation matrix with a size of N×N is further divided. If the image block uses the transformation structure as shown in FIG. 3b, all 4 bits are 0, indicating that each transformation matrix with a size of N×N will not be further divided.
当选用如图3c所示的变换结构时,则4个比特中有2个比特为0,2个比特为1。2个比特为0表示对左下和右上的尺寸为N×N的变换矩阵不再进行划分。2个比特为1表示需要对左上和右下的尺寸为N×N的变换矩阵需要进一步划分,得到尺寸为0.5N×0.5N的变换矩阵。然后在码流第二层结构中用4个比特表示是否需要对左上的尺寸为0.5N×0.5N的变换矩阵进行进一步划分,用4个比特表示是否需要对右下的尺寸为0.5N×0.5N的变换矩阵进行进一步划分,如果图像块使用如图3c所示的变换结构时,上述4+4个比特都为0,表示不再进一步划分。通过上述在码流中逐层标识可以有效、灵活地表示出图像块和子图像块使用的变换块尺寸。When the transformation structure shown in Figure 3c is selected, 2 bits out of 4 bits are 0, and 2 bits are 1. The 2 bits are 0, which means that the transformation matrix of size N×N in the lower left and upper right is not Then divide. Two bits being 1 indicate that the upper-left and lower-right transformation matrices with a size of N×N need to be further divided to obtain a transformation matrix with a size of 0.5N×0.5N. Then in the second layer structure of the code stream, use 4 bits to indicate whether to further divide the transformation matrix with a size of 0.5N×0.5N on the upper left, and use 4 bits to indicate whether to further divide the transformation matrix with a size of 0.5N×0.5 on the lower right The transformation matrix of N is further divided. If the image block uses the transformation structure as shown in FIG. 3c, the above 4+4 bits are all 0, indicating that no further division will be made. Through the above layer-by-layer identification in the code stream, the transformation block size used by the image block and the sub-image block can be effectively and flexibly indicated.
除了上述逐层标识变换块对应的层数和尺寸的方法,还有根据图像块所使用的预测块类型确定变换块尺寸的方法。不同的预测块类型对应于不同的图像块划分方式,可根据图像块的划分方式获得预测块。例如,2N×N划分 方式表示所对应的预测块的尺寸为2N×N(如图1b所示)。In addition to the above method of identifying the layer number and size corresponding to the transformation block layer by layer, there is also a method of determining the size of the transformation block according to the prediction block type used by the image block. Different prediction block types correspond to different image block division methods, and the prediction block can be obtained according to the image block division methods. For example, the 2N×N division means that the size of the corresponding prediction block is 2N×N (as shown in Figure 1b).
在视频编解码技术中,通常由于两个预测块边界对应的残差数据会存在跳跃性的变换,所以如果变换矩阵跨过了两个预测块的边界则会使变换的作用减弱,不能有效地去除图像块的残差的相关性,不能有效的去除图像块的冗余信息,降低编码效率。图4a-图4d是根据预测块类型确定变换块尺寸的示意图。In video coding and decoding technology, usually there will be a jumpy transformation in the residual data corresponding to the boundary of two prediction blocks, so if the transformation matrix crosses the boundary of two prediction blocks, the effect of transformation will be weakened and cannot be effectively Removing the residual correlation of the image block cannot effectively remove the redundant information of the image block and reduce the coding efficiency. Fig. 4a-Fig. 4d are schematic diagrams of determining the transform block size according to the prediction block type.
如图4a-图4d所示,当图像块分别使用2N×2N、2N×N、N×2N、N×N预测块类型时,图像所对应的变换块分变为2N×2N、N×N、N×N、N×N变换。这种方法目的在于保证变换块不会跨过预测块边界,从而保证编码效率。因此,当图像块使用2N×N、N×2N、N×N预测块类型时,图像使用四个N×N变换块。这种方法通常被称为隐式划分方法(implicit split)。As shown in Figure 4a-Figure 4d, when the image blocks respectively use 2N×2N, 2N×N, N×2N, N×N prediction block types, the corresponding transformation blocks of the image are divided into 2N×2N, N×N , N×N, N×N conversion. The purpose of this method is to ensure that the transformation block does not cross the boundary of the prediction block, so as to ensure the coding efficiency. Therefore, when the image block uses 2NxN, Nx2N, NxN prediction block types, the image uses four NxN transform blocks. This approach is often referred to as an implicit split.
在使用逐层标识和隐式划分的方法中,变换矩阵的尺寸并没有与预测块的尺寸关联。如图4b所示,当2N×2N图像块使用2N×N划分方式时,由于划分方式反映了图像块所处区域的纹理信息,此时图像块所处区域的纹理更倾向于具有水平纹理的特征,但此时图像块仍旧使用N×N变换块。In methods using layer-wise identification and implicit partitioning, the size of the transformation matrix is not linked to the size of the prediction block. As shown in Figure 4b, when the 2N×2N image block uses the 2N×N division method, since the division method reflects the texture information of the area where the image block is located, the texture of the area where the image block is located is more inclined to have a horizontal texture. features, but at this time the image block still uses N×N transform blocks.
由于变换矩阵的尺寸没有与预测块的尺寸关联,导致变换矩阵没有利用预测块的信息有效地去除图像块的冗余信息,从而影响编码效率。本发明实施例在确定变换块尺寸时,采用适应划分方式的变换块,从而能够提高图像压缩效率。Since the size of the transformation matrix is not related to the size of the prediction block, the transformation matrix does not use the information of the prediction block to effectively remove the redundant information of the image block, thereby affecting the coding efficiency. In the embodiment of the present invention, when determining the size of the transform block, the transform block adapted to the division mode is used, so that the image compression efficiency can be improved.
图5是根据本发明一个实施例的确定变换块尺寸的方法的流程图。Fig. 5 is a flowchart of a method for determining a transform block size according to an embodiment of the present invention.
501,根据图像块信息和图像块的划分方式,获得图像块对应的变换块的参数。501. Obtain parameters of a transformation block corresponding to the image block according to the image block information and the division manner of the image block.
可选地,在一个实施例中,上述变换块的参数包括变换块对应的层数(下文中称为trafoDepth)或变换块尺寸的表示值(下文中称为log2TrafoSize)。Optionally, in an embodiment, the above parameters of the transformation block include the number of layers corresponding to the transformation block (hereinafter referred to as trafoDepth) or the representation value of the size of the transformation block (hereinafter referred to as log2TrafoSize).
例如,变换块尺寸和变换块尺寸的表示值之间的关系可以用下式表示:For example, the relationship between the transform block size and the representation value of the transform block size can be represented by the following equation:
变换块尺寸=2log2TrafoSize,或者可以用移位方法表示为1<<log2TrafoSize。其中“<<”代表向左移位操作。Transform block size = 2 log2TrafoSize , or it can be expressed as 1<<log2TrafoSize by shifting method. Among them, "<<" represents a shift operation to the left.
可选地,在另一实施例中,图像块信息可包括图像块尺寸、图像块尺寸的表示值、图像块的层数或图像块尺寸的编号。这些图像块信息的形式彼此之间是对应的,可以直接或间接地得到图像块尺寸的表示值(下文中称为log2CUSize)。例如,图像块尺寸和图像块尺寸的表示值之间的关系可以用下 式表示:Optionally, in another embodiment, the image block information may include the image block size, the representation value of the image block size, the number of layers of the image block, or the serial number of the image block size. The forms of these image block information correspond to each other, and the representation value of the image block size (hereinafter referred to as log2CUSize) can be obtained directly or indirectly. For example, the relationship between the image block size and the representation value of the image block size can be expressed by the following formula:
图像块尺寸=2log2CUSize,或者可以用移位方法表示为1<<log2CUSize。其中“<<”代表向左移位操作。Image block size = 2 log2CUSize , or it can be expressed as 1<<log2CUSize by shifting method. Among them, "<<" represents a shift operation to the left.
在下文中,为了描述简洁,以图像块尺寸的表示值log2CUSize作为图像块信息的例子进行描述,但本发明实施例不限于此,图像块信息可以包括其他形式。In the following, for the sake of brevity, the image block size representation value log2CUSize is used as an example of the image block information, but the embodiment of the present invention is not limited thereto, and the image block information may include other forms.
可选地,在一个实施例中,变换块尺寸的表示值等于图像块尺寸的表示值减去变换块对应的层数,log2TrafoSize=log2CUSize-trafoDepth。Optionally, in an embodiment, the representation value of the transform block size is equal to the representation value of the image block size minus the number of layers corresponding to the transform block, log2TrafoSize=log2CUSize-trafoDepth.
或者,变换块尺寸的表示值等于图像块尺寸的表示值减去m1,m1为正整数,log2TrafoSize=log2CUSize-m1。Alternatively, the representation value of the transform block size is equal to the representation value of the image block size minus m1, where m1 is a positive integer, log2TrafoSize=log2CUSize-m1.
或者,变换块尺寸的表示值等于图像块尺寸的表示值减去变换块对应的层数再减去m2,m2为正整数,log2TrafoSize=log2CUSize-trafoDepth-m2。Alternatively, the representation value of the transform block size is equal to the representation value of the image block size minus the number of layers corresponding to the transform block minus m2, m2 is a positive integer, log2TrafoSize=log2CUSize-trafoDepth-m2.
另外,可根据图像块的划分方式获得预测块。In addition, the prediction block can be obtained according to the division manner of the image block.
502,根据变换块的参数和图像块的划分方式,获得变换块尺寸。502. Obtain the size of the transform block according to the parameters of the transform block and the division manner of the image block.
可选地,在一个实施例中,可根据变换块的参数,获得变换块的第一尺寸。例如,在该参数为变换块对应的层数trafoDepth时,第一尺寸=2log2CUSize-trafoDepth或第一尺寸=1<<(log2TrafoSize-trafoDepth)。或者,在该参数为变换块尺寸的表示值log2TrafoSize时,第一尺寸=2log2TrafoSize或第一尺寸=1<<log2TrafoSize。Optionally, in an embodiment, the first size of the transform block may be obtained according to parameters of the transform block. For example, when the parameter is the layer number trafoDepth corresponding to the transform block, the first size=2 log2CUSize-trafoDepth or the first size=1<<(log2TrafoSize-trafoDepth). Or, when the parameter is the representative value log2TrafoSize of the transform block size, the first size=2 log2TrafoSize or the first size=1<<log2TrafoSize.
在确定变换块尺寸时,根据第一尺寸确定变换块尺寸。例如,变换块的水平方向尺寸等于该第一尺寸的h倍,变换块的竖直方向尺寸等于该第一尺寸的v倍,其中h和v大于0。例如,在预测块的水平方向尺寸大于竖直方向尺寸时,h大于v,或者在预测块的水平方向尺寸小于竖直方向尺寸时,h小于v,或者在预测块的水平方向尺寸等于竖直方向尺寸时,h等于v。When determining the size of the transform block, the size of the transform block is determined according to the first size. For example, the horizontal size of the transform block is equal to h times the first size, and the vertical size of the transform block is equal to v times the first size, where h and v are greater than 0. For example, when the horizontal size of the predicted block is larger than the vertical size, h is greater than v, or when the horizontal size of the predicted block is smaller than the vertical size, h is smaller than v, or when the horizontal size of the predicted block is equal to the vertical size In the direction dimension, h is equal to v.
本发明实施例本发明实施例在确定变换块尺寸时,根据图像块对应的变换块的参数和图像块的划分方式,获得变换块尺寸,因此能够采用适应图像块的划分方式的变换块,提高了图像压缩效率。Embodiments of the present invention When determining the size of the transformation block, the embodiment of the present invention obtains the size of the transformation block according to the parameters of the transformation block corresponding to the image block and the division method of the image block. Therefore, a transformation block suitable for the division method of the image block can be used to improve image compression efficiency.
图5的方法可用于图像编解码过程中。例如,在编码过程中,可对利用图5所述的方法获得的变换块尺寸进行编码,将编码的结果写入码流中。另一方面,在解码过程中,可以从码流中解析上述编码的结果,按照图5所述的方法,得到相应的变换块尺寸。The method in Fig. 5 can be used in the process of image encoding and decoding. For example, during the encoding process, the transform block size obtained by using the method described in FIG. 5 may be encoded, and the encoded result may be written into the code stream. On the other hand, in the decoding process, the above encoding result can be analyzed from the code stream, and the corresponding transform block size can be obtained according to the method described in FIG. 5 .
下面结合具体例子,更加详细地描述本发明的实施例。The embodiments of the present invention will be described in more detail below in conjunction with specific examples.
图6a和图6b是本发明一个实施例的变换块的示意图。下面结合图1a-图1d描述本实施例。Fig. 6a and Fig. 6b are schematic diagrams of transform blocks according to an embodiment of the present invention. This embodiment is described below in conjunction with FIGS. 1a-1d.
在本实施例中使用变换块对应的层数trafoDepth作为变换块的参数。首先确定图像块的尺寸为2M×2M,2M以参数log2CUSize表示,二者关系为2M=1<<log2CUSize。In this embodiment, the layer number trafoDepth corresponding to the transform block is used as a parameter of the transform block. Firstly, the size of the image block is determined to be 2M×2M, and 2M is represented by the parameter log2CUSize, and the relationship between the two is 2M=1<<log2CUSize.
然后,根据图像块的划分方式确定图像块对应的变换块所处的层数trafoDepth。如图1a所示,图像块使用2N×2N划分,其划分方式为2N×2N,此时图像块对应的变换块位于第零层,trafoDepth的值为0。如图1b所示,图像块使用2N×N划分,其划分方式为2N×N,此时图像块对应的变换块位于第一层,trafoDepth的值为1。如图1c所示,图像块使用N×2N划分,其划分方式为N×2N,此时图像块对应的变换块位于第一层,trafoDepth的值为1。如图1d所示,图像块使用N×N划分,其划分方式为N×N,此时图像块对应的变换块位于第一层,trafoDepth的值为1。此时,第一尺寸为1<<(log2CUSize-trafoDepth)。Then, the number of layers trafoDepth where the transformation block corresponding to the image block is located is determined according to the division manner of the image block. As shown in Figure 1a, the image block is divided by 2N×2N, and the division method is 2N×2N. At this time, the transformation block corresponding to the image block is located at the zeroth layer, and the value of trafoDepth is 0. As shown in FIG. 1b, the image block is divided by 2N×N, and the division method is 2N×N. At this time, the transformation block corresponding to the image block is located in the first layer, and the value of trafoDepth is 1. As shown in FIG. 1c, the image block is divided by N×2N, and the division method is N×2N. At this time, the transformation block corresponding to the image block is located in the first layer, and the value of trafoDepth is 1. As shown in FIG. 1d, the image block is divided by N×N, and the division method is N×N. At this time, the transformation block corresponding to the image block is located in the first layer, and the value of trafoDepth is 1. At this time, the first size is 1<<(log2CUSize-trafoDepth).
根据前述已确定的图像块对应的变换块所处的层数,以及图像块所使用的划分方式确定变换块的长和宽。如图1a所示,图像块使用2N×2N划分方式,此时变换块对应的层数为0,图像块对应的变换块尺寸与图像块尺寸一致,仍为2M×2M(h=2,v=2),即此时变换块尺寸为(1<<log2CUSize)×(1<<log2CUSize )。The length and width of the transform block are determined according to the layer number of the transform block corresponding to the determined image block and the division method used for the image block. As shown in Figure 1a, the image block is divided into 2N×2N. At this time, the number of layers corresponding to the transformation block is 0, and the size of the transformation block corresponding to the image block is consistent with the size of the image block, which is still 2M×2M (h=2, v =2), that is, the transform block size is (1<<log2CUSize)×(1<<log2CUSize ).
如图1b所示,图像块使用2N×N划分方式,此时变换块对应的层数为1。此时,图像块所处区域对应的图像纹理更倾向于水平图像纹理,使用2N×0.5N变换块比N×N变换块更能提高编码效率。As shown in FIG. 1 b , the image block is divided in a 2N×N manner, and the number of layers corresponding to the transform block is 1 at this time. At this time, the image texture corresponding to the region where the image block is located is more inclined to the horizontal image texture, and using 2N×0.5N transform blocks can improve coding efficiency more than N×N transform blocks.
在本实施例中图像块使用2N×N划分方式时,变换块如图6a所示使用2M×0.5M变换(h=2,v=0.5),即变换块水平方向尺寸与图像块水平方向尺寸一致,变换块垂直方向尺寸为图像块垂直方向尺寸的四分之一。如果以参数log2CUSize和trafoDepth表示,此时2N×N划分方式对应的变换块尺寸为(1<<log2CUSize)×(1<<(log2CUSize-trafoDepth-1)),或(1<<log2CUSize)×((1<<log2CUSize)>>(trafoDepth+1))。In this embodiment, when the image block is divided into 2N×N, the transformation block uses 2M×0.5M transformation (h=2, v=0.5) as shown in Figure 6a, that is, the horizontal dimension of the transformation block and the horizontal dimension of the image block Consistently, the vertical size of the transformation block is a quarter of the vertical size of the image block. If expressed by the parameters log2CUSize and trafoDepth, the transform block size corresponding to the 2N×N division method is (1<<log2CUSize)×(1<<(log2CUSize-trafoDepth-1)), or (1<<log2CUSize)×( (1<<log2CUSize)>>(trafoDepth+1)).
类似地,当图像块使用如图1c所示N×2N划分方式时,变换块对应的层数为1,且图像块所处的区域对应的图像纹理更倾向于垂直图像纹理,使用 0.5M×2M变换块比N×N变换块更能提高编码效率。因此,在本发明中图像块使用N×2N划分方式时,变换块如图6b所示使用0.5M×2M变换(h=0.5,v=2),即变换块水平方向尺寸为图像块水平方向尺寸的四分之一,变换块垂直方向尺寸与图像块垂直方向尺寸一致。如果以参数log2CUSize和trafoDepth表示,此时N×2N划分方式对应的变换块尺寸为(1<<(log2CUSize-trafoDepth-1))×(1<<log2CUSize),或((1<<log2CUSize)>>(trafoDepth+1))×(1<<log2CUSize)。Similarly, when the image block uses the N×2N division method as shown in Figure 1c, the number of layers corresponding to the transformation block is 1, and the image texture corresponding to the area where the image block is located is more inclined to the vertical image texture, use 0.5M× A 2M transform block can improve coding efficiency more than an N×N transform block. Therefore, when the image block uses the N×2N division method in the present invention, the transformation block uses 0.5M×2M transformation (h=0.5, v=2) as shown in Figure 6b, that is, the horizontal dimension of the transformation block is the horizontal direction of the image block A quarter of the size, the vertical size of the transformation block is consistent with the vertical size of the image block. If expressed by the parameters log2CUSize and trafoDepth, the transform block size corresponding to the N×2N division method is (1<<(log2CUSize-trafoDepth-1))×(1<<log2CUSize), or ((1<<log2CUSize)> >(trafoDepth+1))×(1<<log2CUSize).
如图1d所示,图像块使用N×N划分方式,变换块对应的层数为1,由于N×N划分方式将2N×2N图像块沿水平和垂直方向划分成四个等大的方形预测块,没法根据预测块尺寸判断图像块所处区域的纹理信息,因此N×N预测块对应的变换块尺寸为M×M(h=1,v=1),即变换块水平方向和垂直方向尺寸各为图像块尺寸的二分之一。以参数log2CUSize和trafoDepth表示,此时N×N划分方式对应的变换块尺寸为(1<<(log2CUSize-trafoDepth))×(1<<(log2CUSize-trafoDepth)),或((1<<log2CUSize)>>trafoDepth)×((1<<log2CUSize)>>trafoDepth)。As shown in Figure 1d, the image block uses the N×N division method, and the number of layers corresponding to the transformation block is 1. Due to the N×N division method, the 2N×2N image block is divided into four equal-sized square predictions along the horizontal and vertical directions. block, it is impossible to judge the texture information of the area where the image block is located according to the size of the predicted block, so the size of the transformed block corresponding to the N×N predicted block is M×M (h=1, v=1), that is, the horizontal direction and vertical direction of the transformed block The orientation dimensions are each half the size of the image block. Indicated by the parameters log2CUSize and trafoDepth, the transform block size corresponding to the N×N division method is (1<<(log2CUSize-trafoDepth))×(1<<(log2CUSize-trafoDepth)), or ((1<<log2CUSize) >>trafoDepth)×((1<<log2CUSize)>>trafoDepth).
具体的,当图像块尺寸为32×32时,如前所述方法,首先得到2N×2N、2N×N、N×2N、N×N划分方式的变换块对应层数trafoDepth的值分别为0、1、1、1,根据所述的划分方式得到变换块尺寸分别为32×32、32×8、8×32、16×16。Specifically, when the size of the image block is 32×32, as described above, the value of trafoDepth corresponding to the layer number trafoDepth of the transformation block divided into 2N×2N, 2N×N, N×2N, and N×N is respectively 0. .
本发明实施例在确定变换块尺寸时,根据图像块对应的变换块的参数和图像块的划分方式,获得变换块尺寸,因此能够采用适应图像块的划分方式的变换块,提高了图像压缩效率。In the embodiment of the present invention, when determining the size of the transformation block, the size of the transformation block is obtained according to the parameters of the transformation block corresponding to the image block and the division method of the image block, so the transformation block suitable for the division method of the image block can be used, and the image compression efficiency is improved. .
下面描述本发明的另一实施例。在本实施例中,变换块的参数为变换块尺寸的表示值log2TrafoSize。Another embodiment of the present invention is described below. In this embodiment, the parameter of the transformation block is log2TrafoSize, which represents the size of the transformation block.
首先确定图像块的尺寸为2M×2M,2M以参数log2CUSize表示,二者关系为2M=1<<log2CUSize。log2TrafoSize的初始值为log2CUSize,可根据log2TrafoSize=log2CUSize-trafoDepth得到不同层数对应的log2TrafoSize。Firstly, the size of the image block is determined to be 2M×2M, and 2M is represented by the parameter log2CUSize, and the relationship between the two is 2M=1<<log2CUSize. The initial value of log2TrafoSize is log2CUSize, and log2TrafoSize corresponding to different layers can be obtained according to log2TrafoSize=log2CUSize-trafoDepth.
然后根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值。如图1a所示,图像块使用2N×2N划分,其划分方式为2N×2N,此时图像块对应的变换块log2TrafoSize的值不变,即等于初始值log2CUSize。图1b所示,图像块使用2N×N划分,其划分方式为2N×N,此时图像块对应的变换块log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-1。图1c所 示,图像块使用N×2N划分,其划分方式为N×2N,此时图像块对应的变换块log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-1。图1d所示,图像块使用N×N划分,其划分方式为N×N,此时图像块对应的变换块log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-1。Then determine the value of the transformation block log2TrafoSize corresponding to the image block according to the division method of the image block. As shown in Figure 1a, the image block is divided by 2N×2N, and the division method is 2N×2N. At this time, the value of log2TrafoSize of the transformation block corresponding to the image block remains unchanged, which is equal to the initial value of log2CUSize. As shown in FIG. 1b , the image block is divided by 2N×N, and the division method is 2N×N. At this time, the value of log2TrafoSize of the transformation block corresponding to the image block is reduced by one, that is, log2TrafoSize=log2CUSize-1. As shown in Figure 1c, the image block is divided by N×2N, and the division method is N×2N. At this time, the value of log2TrafoSize of the transformation block corresponding to the image block is reduced by 1, that is, log2TrafoSize=log2CUSize-1. As shown in FIG. 1d, the image block is divided by N×N, and the division method is N×N. At this time, the value of log2TrafoSize of the transformation block corresponding to the image block is reduced by one, that is, log2TrafoSize=log2CUSize-1.
这里,上述log2TrafoSize=log2CUSize-1可以是基于公式log2TrafoSize=log2CUSize-m1(m1=1),或者基于公式log2TrafoSize=log2CUSize-trafoDepth,其中类似于实施例一中所述,划分方式2N×N、N×2N、N×N的变换块对应的层数为trafoDepth=1。Here, the above-mentioned log2TrafoSize=log2CUSize-1 may be based on the formula log2TrafoSize=log2CUSize-m1 (m1=1), or based on the formula log2TrafoSize=log2CUSize-trafoDepth, wherein, similar to that described in Embodiment 1, the division method is 2N×N, N× The number of layers corresponding to 2N, N×N transform blocks is trafoDepth=1.
根据前述原理,通过已确定的变换块的参数log2TrafoSize,以及图像块所使用的划分方式确定变换块的长和宽。变换块的长是指变换块在水平方向上的尺寸,变换块的宽是指变换块在竖直方向上的尺寸。According to the aforementioned principle, the length and width of the transform block are determined by the determined parameter log2TrafoSize of the transform block and the division method used for the image block. The length of the transform block refers to the size of the transform block in the horizontal direction, and the width of the transform block refers to the size of the transform block in the vertical direction.
此时,第一尺寸为1<<log2TrafoSize。如图1a所示,图像块使用2N×2N划分方式,图像块对应的变换块尺寸与图像块尺寸一致,仍为2M×2M(h=2,v=2),即此时变换块的尺寸为(1<<log2TrafoSize)×(1<<log2TrafoSize)。如图1b所示,图像块使用2N×N划分方式,此时变换块如图5a所示使用2M×0.5M变换(h=2,v=0.5),即变换块水平方向尺寸与图像块水平方向尺寸一致,变换块垂直方向尺寸为图像块垂直方向尺寸的四分之一,如果以参数log2TrafoSize表示,此时2N×N划分方式对应的变换块尺寸为(1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1))。类似地,当图像块使用如图1c所示N×2N划分方式时,变换块如图5b所示使用0.5M×2M变换(h=0.5,v=2),即变换块水平方向尺寸为图像块水平方向尺寸的四分之一,变换块垂直方向尺寸与图像块垂直方向尺寸一致,以参数log2TrafoSize,此时N×2N划分方式对应的变换块尺寸为(1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1))。At this time, the first size is 1<<log2TrafoSize. As shown in Figure 1a, the image block is divided into 2N×2N, and the size of the transformation block corresponding to the image block is consistent with the size of the image block, which is still 2M×2M (h=2, v=2), that is, the size of the transformation block at this time It is (1<<log2TrafoSize)×(1<<log2TrafoSize). As shown in Figure 1b, the image block uses 2N×N division method, and at this time, the transformation block uses 2M×0.5M transformation (h=2, v=0.5) as shown in Figure 5a, that is, the horizontal dimension of the transformation block is equal to the image block level The size of the direction is consistent, and the vertical size of the transformation block is a quarter of the vertical size of the image block. If it is expressed by the parameter log2TrafoSize, the size of the transformation block corresponding to the 2N×N division method is (1<<(log2TrafoSize+1)) ×(1<<(log2TrafoSize-1)). Similarly, when the image block uses the N×2N division method as shown in Figure 1c, the transformation block uses 0.5M×2M transformation (h=0.5, v=2) as shown in Figure 5b, that is, the horizontal dimension of the transformation block is A quarter of the horizontal size of the block, and the vertical size of the transformation block is consistent with the vertical size of the image block. With the parameter log2TrafoSize, the size of the transformation block corresponding to the N×2N division method is (1<<(log2TrafoSize-1)) ×(1<<(log2TrafoSize+1)).
如图1d所示,图像块使用N×N划分方式,变换块尺寸为M×M(h=1,v=1),即变换块水平方向和垂直方向尺寸各为图像块尺寸的二分之一,以参数log2TrafoSize表示,此时N×N划分方式对应的变换块尺寸为(1<<log2TrafoSize)×(1<<log2TrafoSize)。As shown in Figure 1d, the image block is divided by N×N, and the size of the transformation block is M×M (h=1, v=1), that is, the horizontal and vertical dimensions of the transformation block are each half of the size of the image block 1. It is represented by the parameter log2TrafoSize. At this time, the transform block size corresponding to the N×N division method is (1<<log2TrafoSize)×(1<<log2TrafoSize).
具体的,当图像块尺寸为32×32时,如前所述方法,log2CUSize的值为5,log2TrafoSize的初始值为5,首先得到2N×2N、2N×N、N×2N、N×N划分方式对应的log2TrafoSize的值5、4、4、4,根据所述的划分方式得到变换 块尺寸分别为32×32、32×8、8×32、16×16。Specifically, when the image block size is 32×32, as described above, the value of log2CUSize is 5, and the initial value of log2TrafoSize is 5. First, 2N×2N, 2N×N, N×2N, and N×N divisions are obtained The values of log2TrafoSize corresponding to the method are 5, 4, 4, and 4. According to the above division method, the transform block sizes are 32×32, 32×8, 8×32, and 16×16, respectively.
本发明实施例在确定变换块尺寸时,根据图像块对应的变换块的参数和图像块的划分方式,获得变换块尺寸,因此能够采用适应图像块的划分方式的变换块,提高了图像压缩效率。In the embodiment of the present invention, when determining the size of the transformation block, the size of the transformation block is obtained according to the parameters of the transformation block corresponding to the image block and the division method of the image block, so the transformation block suitable for the division method of the image block can be used, and the image compression efficiency is improved. .
下面描述本发明的另一实施例。在类似于上一实施例,确定图像块的尺寸为2M×2M,2M以参数log2CUSize表示,二者关系为2M=1<<log2CUSize,设用于标识变换块尺寸基本信息的参数为log2TrafoSize,log2TrafoSize的初始值为log2CUSize。在本实施例中,在图5的501之前,根据划分方式和分层标志值(下文中称为max_transform_hierarchy_depth_inter)得到划分标志值(下文中称为InterSplitFlag),该分层标志值用于表示变换块是否采用逐层标识的方式,并基于划分标志值确定是否根据图像块的划分方式确定变换块尺寸。Another embodiment of the present invention is described below. Similar to the previous embodiment, the size of the image block is determined to be 2M×2M, 2M is represented by the parameter log2CUSize, the relationship between the two is 2M=1<<log2CUSize, and the parameters used to identify the basic information of the transformed block size are log2TrafoSize, log2TrafoSize The initial value of log2CUSize. In this embodiment, before 501 in FIG. 5, the division flag value (hereinafter referred to as InterSplitFlag) is obtained according to the division method and the layer flag value (hereinafter referred to as max_transform_hierarchy_depth_inter), and the layer flag value is used to represent the transform block Whether to use layer-by-layer identification, and determine whether to determine the transformation block size according to the division method of the image block based on the division flag value.
在视频编码和解码方法中一个图像块通常会尝试使用不同尺寸的变换对图像块数据进行变换,使用前述逐层标识的方法进行标识变换块所在层数或变换块的尺寸。同时,在视频编码和解码方法中一个图像块也有可能只是用一种尺寸的变换块对图像块数据进行变换,即不使用上述逐层标识的方法标识变换块的尺寸或变换块所在层数。当视频编解码标准或系统中同时使用这两种方法时,通常会使用参数对这两种方法进行标识。设该参数为max_transform_hierarchy_depth_inter,当编码端在码流中标识max_transform_hierarchy_depth_inter值为1时,表示编码端图像块使用多种尺寸的变换块对图像块数据进行变换,使用前述逐层标识的方法进行标识变换块所在层数或变换块的尺寸;当编码端在码流中标识max_transform_hierarchy_depth_inter值为0时,表示编码端图像块使用一种尺寸的变换块对图像块数据进行变换;当解码端解析码流得到max_transform_hierarchy_depth_inter值为1时,表示解码端图像块使用逐层标识的方法获得变换块所在层数或变换块的尺寸;当解码端解析码流得到maxt_ransform_hierarchy_depth_inter值为0时,表示解码端图像块使用一种尺寸的变换块对图像块数据进行变换。In the video encoding and decoding method, an image block usually tries to use transformations of different sizes to transform the data of the image block, and the aforementioned layer-by-layer identification method is used to identify the layer number of the transformed block or the size of the transformed block. At the same time, in the video encoding and decoding method, an image block may only use a transformation block of one size to transform the image block data, that is, the above-mentioned layer-by-layer identification method is not used to identify the size of the transformation block or the number of layers where the transformation block is located. When the two methods are used simultaneously in the video codec standard or system, parameters are usually used to identify the two methods. Set this parameter to max_transform_hierarchy_depth_inter. When the encoding end marks the value of max_transform_hierarchy_depth_inter in the code stream as 1, it means that the image block at the encoding end uses transformation blocks of various sizes to transform the image block data, and uses the aforementioned layer-by-layer identification method to identify the transformation block The number of layers or the size of the transform block; when the encoder marks the max_transform_hierarchy_depth_inter value in the code stream as 0, it means that the image block at the encoder uses a transform block of one size to transform the image block data; when the decoder parses the code stream to get max_transform_hierarchy_depth_inter When the value is 1, it means that the image block at the decoding end uses the layer-by-layer identification method to obtain the number of layers where the transformation block is located or the size of the transformation block; when the value of maxt_ransform_hierarchy_depth_inter is 0 when the decoding end parses the code stream, it means that the image block at the decoding end uses a size The transform block transforms the image block data.
根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值的方法如下:The method of determining the value of the transformation block log2TrafoSize corresponding to the image block according to the division method of the image block is as follows:
首先按下表得到变量InterSplitFlag的值:First get the value of the variable InterSplitFlag according to the table below:
例如,上述2N×nD、2N×nU、nL×2N和nR×2N划分方式分别对应图2a、2b、2c和2d所示的划分,n=0.5N。For example, the above 2N×nD, 2N×nU, nL×2N and nR×2N division methods respectively correspond to the divisions shown in Figures 2a, 2b, 2c and 2d, and n=0.5N.
当InterSplitFlag的值为0且max_transform_hierarchy_depth_inter的值不为0时,使用前述逐层标识的方法确定log2TrafoSize的值时,可按照公式log2TraSfoize=log2CUSize-trafoDepth。例如,当变换块位于第零层时,log2TrafoSize的值不变,即log2TrafoSize=log2CUSize;当变换块位于第一层时,log2TrafoSize的相对于第零层log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-1;当变换块位于第二层时,log2TrafoSize的相对于第一层log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-2;以此类推获得log2TrafoSize 的值。当InterSplitFlag的值为0且max_transform_hierarchy_depth_inter的值为0时,使用前述隐式划分方法(implicit split)确定变换块尺寸,例如在max_transform_hierarchy_depth_inter的值为0时,2N×2N划分类型对应的变换块log2TrafoSize的值为尺寸为log2CUSize,尺寸为2M×2M。When the value of InterSplitFlag is 0 and the value of max_transform_hierarchy_depth_inter is not 0, the value of log2TrafoSize can be determined according to the formula log2TraSfoize=log2CUSize-trafoDepth when using the aforementioned layer-by-layer identification method. For example, when the transformation block is on the zeroth layer, the value of log2TrafoSize remains unchanged, that is, log2TrafoSize=log2CUSize; when the transformation block is on the first layer, the value of log2TrafoSize relative to the zeroth layer log2TrafoSize is reduced by 1, that is, log2TrafoSize=log2CUSize- 1; when the transformation block is located in the second layer, the value of log2TrafoSize relative to the value of log2TrafoSize in the first layer is reduced by 1, that is, log2TrafoSize=log2CUSize-2; and so on to obtain the value of log2TrafoSize. When the value of InterSplitFlag is 0 and the value of max_transform_hierarchy_depth_inter is 0, use the aforementioned implicit split method (implicit split) to determine the transform block size, for example, when the value of max_transform_hierarchy_depth_inter is 0, the value of log2TrafoSize of the transform block corresponding to the 2N×2N partition type is a log2CUSize of size 2M by 2M.
当InterSplitFlag的值为1时,如图1b所示,图像块使用2N×N划分,其划分方式为2N×N,此时图像块对应的变换块log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-1。图1c所示,图像块使用N×2N划分,其划分方式为N×2N,此时图像块对应的变换块log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-1。图1d所示,图像块使用N×N划分,其划分方式为N×N,此时图像块对应的变换块log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-1。此时,第一尺寸为1<<log2TrafoSize。When the value of InterSplitFlag is 1, as shown in Figure 1b, the image block is divided by 2N×N, and the division method is 2N×N. At this time, the value of the transformation block log2TrafoSize corresponding to the image block is reduced by 1, that is, log2TrafoSize=log2CUSize- 1. As shown in FIG. 1c, the image block is divided by N×2N, and the division method is N×2N. At this time, the value of log2TrafoSize of the transformation block corresponding to the image block is reduced by one, that is, log2TrafoSize=log2CUSize-1. As shown in FIG. 1d, the image block is divided by N×N, and the division method is N×N. At this time, the value of log2TrafoSize of the transformation block corresponding to the image block is reduced by one, that is, log2TrafoSize=log2CUSize-1. At this time, the first size is 1<<log2TrafoSize.
然后通过已确定的变换块的参数log2TrafoSize,以及图像块所使用的划分方式确定变换块的长和宽。如图1b所示,图像块使用2N×N划分方式,此时变换块如图6a所示使用2M×0.5M变换(h=2,v=0.5),即变换块水平方向尺寸与图像块水平方向尺寸一致,变换块垂直方向尺寸为图像块垂直方向尺寸的四分之一,以参数log2TrafoSize表示,此时2N×N划分方式对应的变换块尺寸为(1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1))。同理,当图像块使用如图1c所示N×2N划分方式时,变换块如图6b所示使用0.5M×2M变换(h=0.5,v=2),即变换块水平方向尺寸为图像块水平方向尺寸的四分之一,变换块垂直方向尺寸与图像块垂直方向尺寸一致,以参数log2TrafoSize,此时N×2N划分方式对应的变换块尺寸为(1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1))。如图1d所示,图像块使用N×N划分方式,变换块尺寸为M×M(h=1,v=1),即变换块水平方向和垂直方向尺寸各为图像块尺寸的二分之一,以参数log2TrafoSize表示,此时N×N划分方式对应的变换块尺寸为(1<<log2TrafoSize)×(1<<log2TrafoSize)。Then, the length and width of the transformation block are determined by the determined parameter log2TrafoSize of the transformation block and the division method used by the image block. As shown in Figure 1b, the image block uses a 2N×N division method. At this time, the transformation block uses a 2M×0.5M transformation (h=2, v=0.5) as shown in Figure 6a, that is, the horizontal dimension of the transformation block is the same as the image block level The size of the direction is consistent, and the vertical size of the transformation block is a quarter of the vertical size of the image block, expressed by the parameter log2TrafoSize. At this time, the size of the transformation block corresponding to the 2N×N division method is (1<<(log2TrafoSize+1))× (1<<(log2TrafoSize-1)). Similarly, when the image block uses the N×2N division method as shown in Figure 1c, the transformation block uses 0.5M×2M transformation (h=0.5, v=2) as shown in Figure 6b, that is, the horizontal dimension of the transformation block is the image A quarter of the horizontal size of the block, and the vertical size of the transformation block is consistent with the vertical size of the image block. With the parameter log2TrafoSize, the size of the transformation block corresponding to the N×2N division method is (1<<(log2TrafoSize-1)) ×(1<<(log2TrafoSize+1)). As shown in Figure 1d, the image block is divided by N×N, and the size of the transformation block is M×M (h=1, v=1), that is, the horizontal and vertical dimensions of the transformation block are each half of the size of the image block 1. It is represented by the parameter log2TrafoSize. At this time, the transform block size corresponding to the N×N division method is (1<<log2TrafoSize)×(1<<log2TrafoSize).
具体的,当图像块尺寸为32×32时,如前所述方法,log2CUSize的值为5,log2TrafoSize的初始值为5,若max_transform_hierarchy_depth_inter值为1,则2N×N、N×2N、N×N划分方式对应的log2TraSfoize的值4、4、4,根据所述的划分方式得到变换块尺寸分别为32×8、8×32、16×16。Specifically, when the image block size is 32×32, as described above, the value of log2CUSize is 5, the initial value of log2TrafoSize is 5, if the value of max_transform_hierarchy_depth_inter is 1, then 2N×N, N×2N, N×N The values of log2TraSfoize corresponding to the division method are 4, 4, and 4. According to the division method, the transform block sizes are respectively 32×8, 8×32, and 16×16.
当InterSplitFlag的值为1时,如图2a-图2d所示,图像块分别使用2N×nU划分、2N×nD划分、nL×2N划分和nR×2N划分,其划分方式分别为2N×nU、2N×nD、nL×2N和nR×2N。此时图像块对应的变换块log2TrafoSize的值减一1,即log2TravSize=log2CUSize-1。然后通过已确定的变换块的参数log2TrafoSize,以及图像块所使用的划分方式确定变换块的长和宽。2N×nU和2N×nD划分类型对应的变换块尺寸为(1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1)),即变换块尺寸为2M×0.5M(h=2,v=0.5)。nL×2N和nR×2N划分类型对应的变换块尺寸为(1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1)),即变换块尺寸为0.5M×2M(h=0.5,v=2)。When the value of InterSplitFlag is 1, as shown in Figure 2a-Figure 2d, the image blocks are divided into 2N×nU, 2N×nD, nL×2N and nR×2N respectively, and the division methods are 2N×nU, 2N×nD, nL×2N, and nR×2N. At this time, the value of log2TrafoSize of the transformation block corresponding to the image block is reduced by one, that is, log2TravSize=log2CUSize-1. Then, the length and width of the transformation block are determined by the determined parameter log2TrafoSize of the transformation block and the division method used by the image block. The transform block size corresponding to the 2N×nU and 2N×nD division types is (1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1)), that is, the transform block size is 2M×0.5M (h=2 , v=0.5). The transform block size corresponding to the nL×2N and nR×2N division types is (1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1)), that is, the transform block size is 0.5M×2M (h=0.5 , v=2).
具体的,当图像块尺寸为32×32时,如前所述方法,log2CUSize的值为5,log2TrafoSize的初始值为5,若max_transform_hierarchy_depth_inter值为1,则2N×nU、2N×nD、nL×2N、nR×2N划分方式对应的log2TrafoSize的值4、4、4、4,根据所述的划分方式得到变换块尺寸分别为32×8、32×8、8×32、 8×32。Specifically, when the image block size is 32×32, as described above, the value of log2CUSize is 5, the initial value of log2TrafoSize is 5, if the value of max_transform_hierarchy_depth_inter is 1, then 2N×nU, 2N×nD, nL×2N The values of log2TrafoSize corresponding to the nR×2N division mode are 4, 4, 4, and 4. According to the division mode, the transform block sizes are obtained as 32×8, 32×8, 8×32, and 8×32, respectively.
本发明实施例在确定变换块尺寸时,根据图像块对应的变换块的参数和图像块的划分方式,获得变换块尺寸,因此能够采用适应图像块的划分方式的变换块,提高了图像压缩效率。In the embodiment of the present invention, when determining the size of the transformation block, the size of the transformation block is obtained according to the parameters of the transformation block corresponding to the image block and the division method of the image block, so the transformation block suitable for the division method of the image block can be used, and the image compression efficiency is improved. .
下面描述本发明的另一实施例。在类似于上一实施例,确定图像块的尺寸为2M×2M,2M以参数log2CUSize表示,二者关系为2M=1<<log2CUSize,设用于标识变换块尺寸基本信息的参数为log2TrafoSize,log2TrafoSize的初始值为log2CUSize。在本实施例中,在图5的501之前,根据划分方式和分层标志值(下文中称为max_transform_hierarchy_depth_inter)得到划分标志值(下文中称为InterSplitFlag),该分层标志值用于表示变换块是否采用逐层标识的方式,并基于划分标志值确定是否根据图像块的划分方式确定变换块尺寸。Another embodiment of the present invention is described below. Similar to the previous embodiment, the size of the image block is determined to be 2M×2M, 2M is represented by the parameter log2CUSize, the relationship between the two is 2M=1<<log2CUSize, and the parameters used to identify the basic information of the transformed block size are log2TrafoSize, log2TrafoSize The initial value of log2CUSize. In this embodiment, before 501 in FIG. 5, the division flag value (hereinafter referred to as InterSplitFlag) is obtained according to the division method and the layer flag value (hereinafter referred to as max_transform_hierarchy_depth_inter), and the layer flag value is used to represent the transform block Whether to use layer-by-layer identification, and determine whether to determine the transformation block size according to the division method of the image block based on the division flag value.
设变换块的划分层数为trafoDepth,变换块的尺寸以log2TrafoSize表示,即变换块的尺寸为(1<<log2TrafoSize),log2TrafoSize为变换块尺寸的表示值。trafoDepth的初始值为0。Let the number of division layers of the transformation block be trafoDepth, and the size of the transformation block is represented by log2TrafoSize, that is, the size of the transformation block is (1<<log2TrafoSize), and log2TrafoSize is the representation value of the transformation block size. The initial value of trafoDepth is 0.
当编码端在码流中标识max_transform_hierarchy_depth_inter值为1时,表示编码端图像块使用多种尺寸的变换块对图像块数据进行变换,使用前述逐层标识的方法进行标识变换块所在层数或变换块的尺寸;当编码端在码流中标识max_transform_hierarchy_depth_inter值为0时,表示编码端图像块使用一种尺寸的变换块对图像块数据进行变换;当解码端解析码流得到max_transform_hierarchy_depth_inter值为1时,表示解码端图像块使用逐层标识的方法获得变换块所在层数或变换块的尺寸;当解码端解析码流得到max_transform_hierarchy_depth_inter值为0时,表示解码端图像块使用一种尺寸的变换块对图像块数据进行变换。When the encoding end marks the value of max_transform_hierarchy_depth_inter in the code stream as 1, it means that the image block at the encoding end uses transformation blocks of various sizes to transform the image block data, and uses the aforementioned layer-by-layer identification method to identify the number of layers or transformation blocks where the transformation block is located size; when the encoding end marks the max_transform_hierarchy_depth_inter value in the code stream as 0, it means that the image block at the encoding end uses a transformation block of one size to transform the image block data; when the decoding end parses the code stream and obtains a max_transform_hierarchy_depth_inter value of 1, it means The image block at the decoding end uses the layer-by-layer identification method to obtain the number of layers where the transform block is located or the size of the transform block; when the decoding end parses the code stream and obtains a max_transform_hierarchy_depth_inter value of 0, it means that the image block at the decoding end uses a transform block of one size for the image block The data is transformed.
设图像块大小为2Mx2M。当max_transform_hierarchy_depth_inter值为0时,图像块使用一种尺寸的变换块对图像块数据进行变换。此时,若变换块的尺寸仍为方形(square,即变换块的宽与高相等),则当图像块的划分方式为2NxN或Nx2N时,变换块的尺寸为MxM可以保证变换块不会跨过预测块 边界,此时trafoDepth的值由0变为1。当图像块的划分方式为2NxnU或2NxnD或nLx2N或nLx2N时,变换块的尺寸为0.5Mx0.5M可以保证变换块不会跨过预测块边界,此时trafoDepth的值由0变为2。Let the image block size be 2Mx2M. When the value of max_transform_hierarchy_depth_inter is 0, the image block uses a transform block of one size to transform the image block data. At this time, if the size of the transform block is still square (square, that is, the width and height of the transform block are equal), then when the image block is divided into 2NxN or Nx2N, the size of the transform block is MxM, which can ensure that the transform block does not span Over the prediction block boundary, the value of trafoDepth changes from 0 to 1 at this time. When the division method of the image block is 2NxnU or 2NxnD or nLx2N or nLx2N, the size of the transformation block is 0.5Mx0.5M to ensure that the transformation block will not cross the boundary of the prediction block. At this time, the value of trafoDepth changes from 0 to 2.
具体的,在编解码操作中,可按下述步骤确定变换块的尺寸。Specifically, in the codec operation, the size of the transform block can be determined according to the following steps.
(1)根据图像块的划分方式和变换块的层数获得划分参数interSplitFlag。当图像块的划分方式为2NxN或Nx2N或时,若变换块的层数为0则表示此时变换块的大小与图像块一致,根据前述原理可知变换块仍跨过预测块边界,因此变换块要划分为更小的值,此时设置interSplitFlag值为1,表示变换块需要进行划分;当图像块的划分方式为2NxnU或2NxnD或nLx2N或nLx2N或时,若变换块的层数为0则表示此时变换块的大小与图像块一致,根据前述原理变换块要划分为更小的值,若变换块的层数为1表示变换块的宽和高均为图像块的二分之一,根据前述原理可知变换块仍跨过预测块边界,因此当变换块的层数为0或1时变换块需要进行划分,此时interSplitFlag值为1表示变换块需要进行划分。设图像块划分模式以PartMode指代,2NxN、Nx2N、2NxnU、2NxnD、nLx2N、nLx2N划分类型分别由2NxN、Nx2N、2NxnU、2NxnD、nLx2N、nLx2N表示。interSplitFlag的推导过程可由下列式子表达:(1) Obtain the division parameter interSplitFlag according to the division method of the image block and the number of layers of the transformation block. When the division method of the image block is 2NxN or Nx2N, if the number of layers of the transformation block is 0, it means that the size of the transformation block is consistent with the image block at this time. According to the aforementioned principle, it can be known that the transformation block still crosses the boundary of the prediction block, so the transformation block To divide into smaller values, set the value of interSplitFlag to 1 at this time, indicating that the transformation block needs to be divided; At this time, the size of the transformation block is the same as that of the image block. According to the aforementioned principle, the transformation block should be divided into smaller values. If the number of layers of the transformation block is 1, it means that the width and height of the transformation block are 1/2 of the image block. According to The aforementioned principle shows that the transform block still crosses the boundary of the prediction block, so when the layer number of the transform block is 0 or 1, the transform block needs to be divided. At this time, the value of interSplitFlag is 1, indicating that the transform block needs to be divided. Let the image block division mode be referred to by PartMode, and the division types of 2NxN, Nx2N, 2NxnU, 2NxnD, nLx2N, and nLx2N are represented by 2NxN, Nx2N, 2NxnU, 2NxnD, nLx2N, and nLx2N, respectively. The derivation process of interSplitFlag can be expressed by the following formula:
interSplitFlag=(max_transform_hierarchy_depth_inter==0&&PredMode==MODE_INTER&&((PartMode==PART_2NxN||PartMode==PART_Nx2N)&&trafoDepth==0)||((PartMode==PART_2NxnU||PartMode==PART_2NxnD||PartMode==PART_nLx2N||PartMode==PART_nRx2N)&&trafoDepth <=1))interSplitFlag=(max_transform_hierarchy_depth_inter==0&&PredMode==MODE_INTER&&((PartMode==PART_2NxN||PartMode==PART_Nx2N)&&trafoDepth==0)||((|Mode==PART_2NxnU|| PartMode==PART_nRx2N)&&trafoDepth<=1))
(2)根据划分参数interSplitFlag和图像块的划分方式获得是否进一步划分的参数interFurtherSplitFlag,判断变换块是否进一步划分,即变换块是否划分为0.5Mx0.5M的尺寸。当interSplitFlag的值为1且图像块的划分方式为2NxnU或2NxnD或nLx2N或nLx2N时,interFurtherSplitFlag的值为1。interFurtherSplitFlag的推导过程可由下列式子表达:(2) Obtain the parameter interFurtherSplitFlag whether to further divide according to the division parameter interSplitFlag and the division method of the image block, and judge whether the transformation block is further divided, that is, whether the transformation block is divided into a size of 0.5Mx0.5M. When the value of interSplitFlag is 1 and the division mode of the image block is 2NxnU or 2NxnD or nLx2N or nLx2N, the value of interFurtherSplitFlag is 1. The derivation process of interFurtherSplitFlag can be expressed by the following formula:
interFurtherSplitFlag=interSplitFlag&&(PartMode==PART_2NxnU||PartMode==PART_2NxnD||PartMode==PART_nLx2N||PartMode==PART_nRx2N)interFurtherSplitFlag=interSplitFlag&&(PartMode==PART_2NxnU||PartMode==PART_2NxnD||PartMode==PART_nLx2N||PartMode==PART_nRx2N)
(3)根据interSplitFlag或interSplitFlag和interFurtherSplitFlag参数确 定变换块对应的最大变换块层数。当interSplitFlag为1时,变换块的尺寸由2Mx2M变为更小的尺寸,此时最大变换块层数为1;当interFurtherSplitFlag的值为1时,变换块还需要划分成更小的尺寸,此时最大变换块层数为2。最大变换块层数可由下列式子推导:(3) Determine the maximum number of transform block layers corresponding to the transform block according to interSplitFlag or interSplitFlag and interFurtherSplitFlag parameters. When interSplitFlag is 1, the size of the transformation block changes from 2Mx2M to a smaller size, and the maximum number of transformation block layers is 1; when the value of interFurtherSplitFlag is 1, the transformation block needs to be divided into smaller sizes. The maximum number of transform block layers is 2. The maximum number of transform block layers can be derived from the following formula:
maxDepth=max_transform_hierarchy_depth_inter+interSplitFlag+interFurtherSplitFlagmaxDepth=max_transform_hierarchy_depth_inter+interSplitFlag+interFurtherSplitFlag
(4)当interSplitFlag的值为1时表示变换块需要划分,设置变换块划分标志的值为1用于表示变换块需要进行划分,其中变换块划分标志以split_transform_flag表示(4) When the value of interSplitFlag is 1, it means that the transformation block needs to be divided, and the value of setting the transformation block division flag to 1 is used to indicate that the transformation block needs to be divided, where the transformation block division flag is represented by split_transform_flag
(5)当split_transform_flag的值为1时,变换块的层数加1,即trafoDepth=trafoDepth+1;当split_transform_flag的值为1时,log2TrafoSize的值减1,即log2TrafoSize=log2TrafoSize-1(5) When the value of split_transform_flag is 1, the number of layers of the transform block is increased by 1, that is, trafoDepth=trafoDepth+1; when the value of split_transform_flag is 1, the value of log2TrafoSize is reduced by 1, that is, log2TrafoSize=log2TrafoSize-1
(6)当trafoDepth的值大于或等于maxDepth时,编码端不编码split_transform_flag;(6) When the value of trafoDepth is greater than or equal to maxDepth, the encoder does not encode split_transform_flag;
(7)当trafoDepth的值大于或等于maxDepth时,解码端不解码split_transform_flag。(7) When the value of trafoDepth is greater than or equal to maxDepth, the decoder does not decode split_transform_flag.
下面描述本发明的另一实施例。本实施例中,首先确定图像块的尺寸为2M×2M,2M以参数log2CUSize表示,二者关系为2M=1<<log2CUSize,设用于标识变换块尺寸基本信息的参数为log2TrafoSize,log2TrafoSize的初始值为log2CUSize。根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值。如图6a和6b所示,图像块分别使用2N×nU、2N×nD划分,划分方式为2N×nU、2N×nD,此时n=0.25,即按图像块2N×nU划分方式,图像块被分成2M×0.25M和2M×1.75M两部分;按图像块2N×nD划分方式,图像块被分成2M×1.75M和2M×0.25M两部分。为保证变换块不会跨过预测块边界,此时变换块尺寸需要变得更小以适应预测块大小。log2TrafoSize的值减2,即log2TrafoSize=log2CUSize-2;如图6c和6d所示,图像块分别使用nL×2N、nR×2N划分,划分方式为nL×2N、nR×2N,此时n=0.25,即按图像块nL×2N划分方式,图像块被分成0.25M×2M和2M×1.75M两部分;按图像块nR×2N划分方式,图像块被分成1.75M×2M和0.25M×2M两部分。为保证变换块不会跨过预测块边界,此时变换块尺寸需 要变得更小以适应预测块大小。log2TrafoSize的值减2,即log2TrafoSize=log2CUSize-2。Another embodiment of the present invention is described below. In this embodiment, first determine the size of the image block as 2M×2M, 2M is represented by the parameter log2CUSize, the relationship between the two is 2M=1<<log2CUSize, the parameter used to identify the basic information of the transformation block size is log2TrafoSize, the initial value of log2TrafoSize The value is log2CUSize. Determine the value of the transformation block log2TrafoSize corresponding to the image block according to the division method of the image block. As shown in Figures 6a and 6b, the image blocks are divided by 2N×nU and 2N×nD respectively, and the division methods are 2N×nU and 2N×nD. At this time, n=0.25, that is, according to the division method of the image block 2N×nU, the image block It is divided into two parts of 2M×0.25M and 2M×1.75M; according to the division method of image block 2N×nD, the image block is divided into two parts of 2M×1.75M and 2M×0.25M. In order to ensure that the transform block does not cross the prediction block boundary, the transform block size needs to be made smaller to fit the prediction block size. The value of log2TrafoSize is reduced by 2, that is, log2TrafoSize=log2CUSize-2; as shown in Figure 6c and 6d, the image block is divided by nL×2N and nR×2N respectively, and the division method is nL×2N and nR×2N, and n=0.25 at this time , that is, according to the division method of image block nL×2N, the image block is divided into two parts: 0.25M×2M and 2M×1.75M; according to the division method of image block nR×2N, the image block is divided into two parts: 1.75M×2M and 0.25M×2M part. In order to ensure that the transform block does not cross the prediction block boundary, the transform block size needs to be made smaller to fit the prediction block size. The value of log2TrafoSize is subtracted by 2, that is, log2TrafoSize=log2CUSize-2.
这里,上述log2TrafoSize=log2CUSize-2可以是基于公式log2TrafoSize=log2CUSize-m1(m1=2),或者基于公式log2TrafoSize=log2CUSize-trafoDepth-m2,其中类似于实施例一中所述,划分方式2N×N、N×2N、N×N的变换块对应的层数为trafoDepth=1,另外取m2=1。这里虽然以m1=2或m2=1为例,但是本发明实施例不限于这些具体数值,例如m1或m2可以取更大的值。Here, the above-mentioned log2TrafoSize=log2CUSize-2 may be based on the formula log2TrafoSize=log2CUSize-m1 (m1=2), or based on the formula log2TrafoSize=log2CUSize-trafoDepth-m2, wherein, similar to that described in Embodiment 1, the division method is 2N×N, The number of layers corresponding to N×2N and N×N transform blocks is trafoDepth=1, and m2=1 in addition. Although m1=2 or m2=1 is taken as an example here, the embodiment of the present invention is not limited to these specific values, for example, m1 or m2 may take a larger value.
此时,第一尺寸为1<<log2TrafoSize。At this time, the first size is 1<<log2TrafoSize.
然后,通过已确定的变换块的参数log2TrafoSize,以及图像块所使用的划分方式确定变换块的长和宽。如图7a和7b所示,2N×nU和2N×nD划分方式对应的变换块尺寸为(1<<(log2TrafoSize+2))×(1<<(log2TrafoSize-1)),即变换块尺寸为2M×0.25M(h=2,v=0.25)。如图7c和7d所示,nL×2N和nR×2N划分方式对应的变换块尺寸为(1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+2)),即变换块尺寸为0.25M×2M(h=0.25,v=2)。Then, the length and width of the transformation block are determined by the determined parameter log2TrafoSize of the transformation block and the division method used by the image block. As shown in Figures 7a and 7b, the transform block size corresponding to the 2N×nU and 2N×nD division methods is (1<<(log2TrafoSize+2))×(1<<(log2TrafoSize-1)), that is, the transform block size is 2M×0.25M (h=2, v=0.25). As shown in Figures 7c and 7d, the transform block size corresponding to the nL×2N and nR×2N division methods is (1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+2)), that is, the transform block size is 0.25M×2M (h=0.25, v=2).
具体的,当图像块尺寸为32×32时,如前所述方法,log2CUSize的值为5,log2TrafoSize的初始值为5,首先得到2N×nU、2N×nD、nL×2N和nR×2N划分方式对应的log2TrafoSize的值3、3、3、3,根据所述的划分方式得到变换块尺寸分别为32×4、32×4、4×32、4×32。Specifically, when the image block size is 32×32, as described above, the value of log2CUSize is 5, and the initial value of log2TrafoSize is 5. First, 2N×nU, 2N×nD, nL×2N and nR×2N divisions are obtained The values of log2TrafoSize corresponding to the method are 3, 3, 3, and 3. According to the division method, the transformation block sizes are obtained as 32×4, 32×4, 4×32, and 4×32, respectively.
本发明实施例在确定变换块尺寸时,根据图像块对应的变换块的参数和图像块的划分方式,获得变换块尺寸,因此能够采用适应图像块的划分方式的变换块,提高了图像压缩效率。In the embodiment of the present invention, when determining the size of the transformation block, the size of the transformation block is obtained according to the parameters of the transformation block corresponding to the image block and the division method of the image block, so the transformation block suitable for the division method of the image block can be used, and the image compression efficiency is improved. .
下面描述本发明的另一实施例。本实施例中,首先确定图像块的尺寸为2M×2M,2M以参数log2CUSize表示,二者关系为2M=1<<log2CUSize,设用于标识变换块尺寸基本信息的参数为log2TrafoSize,log2TrafoSize的初始值为log2CUSize。根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值。如图7a和7b所示,图像块分别使用2N×nU、2N×nD划分,划分方式为2N×nU、2N×nD,此时n=0.25,即按图像块2N×nU划分方式,图像块被分成2M×0.25M和2M×1.75M两部分;按图像块2N×nD划分方式,图像块被分成2M×1.75M和2M×0.25M两部分,此时,log2TrafoSize的值减1,即log2TrafoSize=log2CUSize-1。Another embodiment of the present invention is described below. In this embodiment, first determine the size of the image block as 2M×2M, 2M is represented by the parameter log2CUSize, the relationship between the two is 2M=1<<log2CUSize, the parameter used to identify the basic information of the transformation block size is log2TrafoSize, the initial value of log2TrafoSize The value is log2CUSize. Determine the value of the transformation block log2TrafoSize corresponding to the image block according to the division method of the image block. As shown in Figures 7a and 7b, the image blocks are divided by 2N×nU and 2N×nD respectively, and the division methods are 2N×nU and 2N×nD. At this time, n=0.25, that is, according to the division method of the image block 2N×nU, the image block It is divided into two parts: 2M×0.25M and 2M×1.75M; according to the image block 2N×nD division method, the image block is divided into two parts: 2M×1.75M and 2M×0.25M. At this time, the value of log2TrafoSize is reduced by 1, that is, log2TrafoSize = log2CUSize-1.
如图7c和7d所示,图像块分别使用nL×2N、nR×2N划分,划分方式为nL×2N、nR×2N,此时n=0.25,即按图像块nL×2N划分方式,图像块被分成0.25M×2M和2M×1.75M两部分;按图像块nR×2N划分方式,图像块被分成1.75M×2M和0.25M×2M两部分。此时,log2TrafoSize的值减1,即log2TrafoSize=log2CUSize-1。As shown in Figures 7c and 7d, the image blocks are divided by nL×2N and nR×2N respectively, and the division methods are nL×2N and nR×2N. At this time, n=0.25, that is, according to the division method of the image block nL×2N, the image block It is divided into two parts of 0.25M×2M and 2M×1.75M; according to the division method of image block nR×2N, the image block is divided into two parts of 1.75M×2M and 0.25M×2M. At this time, the value of log2TrafoSize is reduced by 1, that is, log2TrafoSize=log2CUSize-1.
此时,第一尺寸为1<<log2TrafoSize。At this time, the first size is 1<<log2TrafoSize.
然后,通过已确定的变换块的参数log2TrafoSize,以及图像块所使用的划分方式确定变换块的长和宽。如图7a和7b所示,2N×nU和2N×nD划分方式由于使用了更小的预测块,为保证变换块不会跨过预测块边界,此时变换块尺寸需要变得更小以适应预测块大小,因此这两种划分方式的变换块尺寸为(1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-2)),即变换块尺寸为2M×0.25M(h=2,v=0.25)。Then, the length and width of the transformation block are determined by the determined parameter log2TrafoSize of the transformation block and the division method used by the image block. As shown in Figures 7a and 7b, the 2N×nU and 2N×nD division methods use smaller prediction blocks, in order to ensure that the transformation block does not cross the boundary of the prediction block, the size of the transformation block needs to be made smaller to accommodate The prediction block size, so the transformation block size of these two division methods is (1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-2)), that is, the transformation block size is 2M×0.25M (h=2 , v=0.25).
类似地,如图7c和7d所示,nL×2N和nR×2N划分方式由于使用了更小的预测块,此时变换块尺寸需要变得更小以适应预测块大小,因此这两种划分方式的变换块尺寸为(1<<(log2TrafoSize-2))×(1<<(log2TrafoSize+1),即变换块尺寸为0.25M×2M(h=0.25,v=2)。Similarly, as shown in Figures 7c and 7d, the nL×2N and nR×2N division methods use smaller prediction blocks, and the transform block size needs to become smaller to accommodate the prediction block size, so the two divisions The transform block size of the mode is (1<<(log2TrafoSize-2))×(1<<(log2TrafoSize+1), that is, the transform block size is 0.25M×2M (h=0.25, v=2).
具体的,当图像块尺寸为32x32时,如前所述方法,log2CUSize的值为5,log2TrafoSize的初始值为5,首先得到2N×nU、2N×nD、nL×2N和nR×2N划分方式对应的log2TrafoSize的值3、3、3、3,根据所述的划分方式得到变换块尺寸分别为32×4、32×4、4×32、4×32。Specifically, when the image block size is 32x32, the value of log2CUSize is 5, and the initial value of log2TrafoSize is 5 as described above. The values of log2TrafoSize are 3, 3, 3, and 3, and the transformation block sizes obtained according to the division method are 32×4, 32×4, 4×32, and 4×32, respectively.
本发明实施例在确定变换块尺寸时,根据图像块对应的变换块的参数和图像块的划分方式,获得变换块尺寸,因此能够采用适应图像块的划分方式的变换块,提高了图像压缩效率。In the embodiment of the present invention, when determining the size of the transformation block, the size of the transformation block is obtained according to the parameters of the transformation block corresponding to the image block and the division method of the image block, so the transformation block suitable for the division method of the image block can be used, and the image compression efficiency is improved. .
图8是根据本发明一个实施例的图像编码方法的流程图。Fig. 8 is a flowchart of an image coding method according to an embodiment of the present invention.
801,根据图像块对应的变换块息的参数,获得至少一个候选变换块尺寸。801. Obtain at least one candidate transform block size according to parameters of transform block information corresponding to the image block.
可选地,在一个实施例中,变换块的参数可以包括变换块对应的层数或变换块尺寸的表示值。此时可按照类似于上述实施例的方式,根据该参数获得候选变换块尺寸,或者根据该参数和图像块信息获得候选变换块尺寸。类似于上述实施例,图像块信息可包括图像块尺寸、图像块尺寸的表示值、图像块的层数或图像块尺寸的编号。Optionally, in an embodiment, the parameters of the transform block may include the number of layers corresponding to the transform block or an indication value of the size of the transform block. At this time, the size of the candidate transform block can be obtained according to the parameter, or the size of the candidate transform block can be obtained according to the parameter and image block information in a manner similar to the above-mentioned embodiments. Similar to the above embodiments, the image block information may include the image block size, the representation value of the image block size, the number of layers of the image block, or the serial number of the image block size.
与上述实施例不同的是,对于每种划分方式,本实施例可获取一个或多 个候选变换块尺寸。例如,2N×N、N×2N和N×N划分方式中的每一个,都可以对应于三个候选变换块尺寸M×M、2M×0.5M和0.5M×2M。Different from the foregoing embodiments, this embodiment can obtain one or more candidate transform block sizes for each division method. For example, each of 2N×N, N×2N and N×N divisions may correspond to three candidate transform block sizes M×M, 2M×0.5M and 0.5M×2M.
802,确定至少一个候选变换块尺寸的编号。802. Determine the serial number of at least one candidate transform block size.
可以直接对候选变换块尺寸进行编号,例如从候选变换块尺寸中的某一变换块尺寸(称为第一变换块尺寸)开始,顺序地编号为0、1、2...。The candidate transform block sizes can be directly numbered, for example, starting from a certain transform block size among the candidate transform block sizes (referred to as the first transform block size), they are numbered sequentially as 0, 1, 2....
可选地,在另一实施例中,可根据图像块的划分方式,对候选变换块尺寸进行编号。换句话说,对于不同的划分方式,候选变换块尺寸的编号可以不同。此时,候选变换块尺寸中的第一变换块尺寸可以是与划分方式相对应的,例如是该划分方式下的最可能变换块尺寸或最优变换块尺寸。举例来说,对于2N×N划分方式,如果按照上述实施例,认为变换块尺寸2M×0.5M能够反映图像的条纹特性,是最优变换块尺寸,则可将该变换块尺寸2M×0.5M作为第一变换块尺寸,据此对候选变换块尺寸进行编号。Optionally, in another embodiment, the sizes of the candidate transformation blocks may be numbered according to the division manner of the image blocks. In other words, for different division methods, the numbers of candidate transform block sizes may be different. At this time, the first transform block size among the candidate transform block sizes may correspond to the division mode, for example, the most likely transform block size or the optimal transform block size in the division mode. For example, for the 2N×N division method, if according to the above-mentioned embodiment, it is considered that the transformation block size 2M×0.5M can reflect the stripe characteristics of the image and is the optimal transformation block size, then the transformation block size 2M×0.5M can be As the first transform block size, the candidate transform block sizes are numbered accordingly.
在一个实施例中,可以将第一变换块尺寸对应于预设编号,例如对应于最小的编号(如编号“0”)或者其他编号。In an embodiment, the first transformation block size may correspond to a preset number, for example, correspond to the smallest number (such as number "0") or other numbers.
803,选择候选变换块尺寸之一,作为图像块对应的变换块的尺寸,并编码变换块的尺寸的编号。803. Select one of the candidate transform block sizes as the size of the transform block corresponding to the image block, and encode the number of the transform block size.
可选地,在对变换块的尺寸的编号进行编码时,将变换块的尺寸的编号编码到图像块的码流中,以便解码端能够从码流中解析出该编号,从而得到相应的变换块尺寸。另外,也可以根据所选择的候选变换块尺寸和上述第一变换块尺寸对应的预设编号,确定写入码流的编号值。Optionally, when encoding the number of the size of the transformation block, encode the number of the size of the transformation block into the code stream of the image block, so that the decoding end can parse the number from the code stream to obtain the corresponding transformation block size. In addition, the number value written into the code stream may also be determined according to the selected candidate transform block size and the preset number corresponding to the first transform block size.
因此,本发明实施例在进行图像编码时,从候选变换块尺寸中选择要使用的变换块尺寸,并对所选的变换块尺寸的对应编号进行编码,因此能够选择合适的变换块,提高了图像压缩效率。Therefore, the embodiment of the present invention selects the transform block size to be used from the candidate transform block sizes when performing image encoding, and encodes the corresponding number of the selected transform block size, so that an appropriate transform block can be selected, improving the Image compression efficiency.
图9是根据本发明一个实施例的图像解码方法的流程图。Fig. 9 is a flowchart of an image decoding method according to an embodiment of the present invention.
901,根据图像块对应的变换块的参数,获得至少一个候选变换块尺寸。901. Obtain at least one candidate transform block size according to parameters of a transform block corresponding to an image block.
901可类似于图8中的801,因此不再重复描述。901 may be similar to 801 in FIG. 8 , so the description will not be repeated.
902,确定至少一个候选变换块尺寸的编号。902. Determine the serial number of at least one candidate transform block size.
902可类似于图8中的802,因此不再重复描述。902 may be similar to 802 in FIG. 8 , so the description will not be repeated.
903,获得变换块的变换块尺寸的编号。903. Obtain the serial number of the transform block size of the transform block.
解码端的操作可以与编码端相对应。例如,如果编码端将变换块的尺寸的编号编码到图像块的码流中,则解码端可解析该码流获得变换块的变换块 尺寸的编号。The operation of the decoding end may correspond to that of the encoding end. For example, if the encoder encodes the number of the size of the transform block into the code stream of the image block, the decoder can parse the code stream to obtain the code of the size of the transform block.
904,根据变换块尺寸的编号获得变换块尺寸。904. Obtain the transform block size according to the serial number of the transform block size.
在902中已经获得候选变换块尺寸的编号和变换块尺寸之间的对应关系,因此在904中可根据变换块尺寸的编号获得变换块尺寸。例如,可根据解析码流获得变换块的变换块尺寸的编号和上述第一变换块尺寸对应的预设编号获得变换块的变换块尺寸。In 902, the corresponding relationship between the number of the candidate transform block size and the size of the transform block has been obtained, so in 904, the size of the transform block can be obtained according to the number of the transform block size. For example, the transform block size of the transform block may be obtained according to the number of the transform block size obtained by parsing the code stream and the preset number corresponding to the first transform block size.
因此,本发明实施例在进行图像解码时,获得候选变换块尺寸及其编号的对应关系,从而在获得所使用的变换块尺寸的编号时,可以得到该变换块尺寸,因此能够得到编码端选择的合适的变换块,提高了图像压缩效率。Therefore, in the embodiment of the present invention, when performing image decoding, the corresponding relationship between the size of the candidate transform block and its number is obtained, so that when the number of the used transform block size is obtained, the size of the transform block can be obtained. The appropriate transformation block of the algorithm improves the image compression efficiency.
下面结合具体例子,更加详细地描述本发明的实施例。The embodiments of the present invention will be described in more detail below in conjunction with specific examples.
在一个实施例中,首先确定图像块的尺寸为2M×2M,2M以参数log2CUSize表示,二者关系为2M=1<<log2CUSize,设用于标识变换块尺寸基本信息的参数为log2TrafoSize,log2TrafoSize的初始值为log2CUSize。根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值。例如,确定图像块对应的变换块log2TrafoSize的数值的方法可以与上述实施例的方法一致。In one embodiment, the size of the image block is first determined to be 2M×2M, and 2M is represented by the parameter log2CUSize, and the relationship between the two is 2M=1<<log2CUSize, and the parameter used to identify the basic information of the transformation block size is log2TrafoSize, and the parameter of log2TrafoSize The initial value is log2CUSize. Determine the value of the transformation block log2TrafoSize corresponding to the image block according to the division method of the image block. For example, the method for determining the value of log2TrafoSize of the transformation block corresponding to the image block may be consistent with the method in the foregoing embodiment.
在本实施例中2N×N、N×2N和N×N划分方式都有三个候选的变换块尺寸:M×M、2M×0.5M和0.5M×2M,编码端遍历每一种候选的变换块尺寸以确定最优的变换块尺寸。如图1b、1c和1d所示,图像块分别使用2N×N、N×2N和N×N划分方式,其三种候选变换块尺寸为(1<<log2TrafoSize)×(1<<log2TrafoSize)、(1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1))和(1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1))。In this embodiment, the 2N×N, N×2N and N×N division methods all have three candidate transform block sizes: M×M, 2M×0.5M and 0.5M×2M, and the encoder traverses each candidate transform block size to determine the optimal transform block size. As shown in Figures 1b, 1c and 1d, the image blocks are divided into 2N×N, N×2N and N×N respectively, and the sizes of the three candidate transform blocks are (1<<log2TrafoSize)×(1<<log2TrafoSize), (1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1)) and (1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1)).
将上述三种候选的变换块尺寸编号。其中,根据划分方式确定-个基准编号对应的变换块尺寸,如2N×N划分方式,其基准编号0对应的变换块尺寸为2M×0.5M。然后,确定其余两种变换块尺寸的编号,如2N×N划分方式,M×M和0.5M×2M变换块尺寸对应的编号分别为1和2。将前述最优的变换块尺寸对应的编号写入码流中。The above three candidate transform block sizes are numbered. Wherein, the transform block size corresponding to a reference number is determined according to the division method, for example, in the 2N×N division method, the transform block size corresponding to the reference number 0 is 2M×0.5M. Then, determine the numbers of the other two transform block sizes, such as the 2N×N division method, the numbers corresponding to the M×M and 0.5M×2M transform block sizes are 1 and 2, respectively. Write the number corresponding to the aforementioned optimal transform block size into the code stream.
上述编码过程的目的在于:在编码端通过遍历选择方式确定一最优的变换块尺寸达到最佳编码效率。同时,为了标识所述选中的最优的变换块尺寸,需要对变换块尺寸进行编号并将编号写入码流中。通常所述编号是以变长方式写入码流中,例如编码‘0’使用1比特符号串‘1’入码流中,编码号 ‘1’、‘2’分别使用2比特符号串‘00’和‘01’写入码流中。因此,将最有可能的变换块尺寸分配最小的比特符号串(如前所述编号0所对应的符号串)可以达到节省编码比特提高编码效率的作用。根据前述分析,划分方式与变换块尺寸之间存在关联,如2N×N划分方式更倾向于使用2M×0.5M的变换块尺寸,因此可以根据划分方式给变换块类型进行编号。The purpose of the above encoding process is to determine an optimal transform block size at the encoding end through traversal selection to achieve the best encoding efficiency. At the same time, in order to identify the selected optimal transform block size, it is necessary to number the transform block size and write the number into the code stream. Usually the number is written into the code stream in a variable-length manner, for example, the code '0' uses a 1-bit symbol string '1' to enter the code stream, and the code numbers '1' and '2' use a 2-bit symbol string '00' respectively ' and '01' are written into the code stream. Therefore, allocating the most likely transform block size to the smallest bit symbol string (such as the symbol string corresponding to the number 0 mentioned above) can achieve the effect of saving coding bits and improving coding efficiency. According to the aforementioned analysis, there is a relationship between the division method and the transform block size. For example, the 2N×N division method tends to use the 2M×0.5M transform block size, so the transform block types can be numbered according to the division method.
当图像块使用2N×N划分方式时,图像块倾向于使用2M×0.5M变换,因此设2M×0.5M对应的编号为0,M×M、0.5M×2M变换对应的编号分别为1和2.当图像块使用N×2N划分方式时,图像块倾向于使用0.5M×2M变换,因此设0.5M×2M对应的编号为0,2M×0.5M、M×M变换对应的编号分别为1和2。当图像块使用N×N划分方式时,图像块倾向于使用M×M变换,因此设M×M对应的编号为0,2M×0.5M、0.5M×2M变换对应的编号分别为1和2。When the image block uses 2N×N division method, the image block tends to use 2M×0.5M transformation, so the number corresponding to 2M×0.5M is set to 0, and the numbers corresponding to M×M and 0.5M×2M transformation are respectively 1 and 2. When the image block uses the N×2N division method, the image block tends to use 0.5M×2M transformation, so the number corresponding to 0.5M×2M is set to 0, and the numbers corresponding to 2M×0.5M and M×M transformation are respectively 1 and 2. When the image block uses the N×N division method, the image block tends to use M×M transformation, so the number corresponding to M×M is 0, and the numbers corresponding to 2M×0.5M and 0.5M×2M transformation are 1 and 2 respectively .
解码端为编码端的逆过程。首先,根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值。所述确定图像块对应的变换块log2TrafoSize的数值的方法与上述方法一致。根据log2TrafoSize的数值获得候选的变换块尺寸。然后,解析码流获得变换块尺寸的编号,根据划分方式获得编号对应的变换块尺寸。根据所述编号获得图像块对应的变换块尺寸。The decoding end is the reverse process of the encoding end. First, the value of log2TrafoSize of the transformation block corresponding to the image block is determined according to the division method of the image block. The method for determining the value of the log2TrafoSize of the transformation block corresponding to the image block is consistent with the above method. Obtain the candidate transform block size according to the value of log2TrafoSize. Then, analyze the code stream to obtain the number of the transformation block size, and obtain the transformation block size corresponding to the number according to the division method. The transform block size corresponding to the image block is obtained according to the number.
因此,本发明实施例在进行图像编解码时,从候选变换块尺寸中选择要使用的变换块尺寸,并对所选的变换块尺寸的对应编号进行编码,因此能够选择合适的变换块,提高了图像压缩效率。Therefore, the embodiment of the present invention selects the transform block size to be used from the candidate transform block sizes when performing image encoding and decoding, and encodes the corresponding number of the selected transform block size, so that an appropriate transform block can be selected to improve image compression efficiency.
在另一实施例中,首先确定图像块的尺寸为2M×2M,2M以参数log2CUSize表示,二者关系为2M=1<<log2CUSize,设用于标识变换块尺寸基本信息的参数为log2TrafoSize,log2TrafoSize的初始值为log2CUSize。根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值。In another embodiment, the size of the image block is first determined to be 2M×2M, 2M is represented by the parameter log2CUSize, the relationship between the two is 2M=1<<log2CUSize, and the parameters used to identify the basic information of the transformation block size are log2TrafoSize, log2TrafoSize The initial value of log2CUSize. Determine the value of the transformation block log2TrafoSize corresponding to the image block according to the division method of the image block.
当图像块前述逐层标识的方法确定log2TrafoSize的值时,当变换块位于第零层时,log2TrafoSize的值不变,即log2TrafoSize=log2CUSize;当变换块位于第一层时,log2TrafoSize的相对于第零层log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-1;当变换块位于第二层时,log2TrafoSize的相对于第一层log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-2;以此类推获得log2TrafoSize的值。When the value of log2TrafoSize is determined by the layer-by-layer identification method of the image block, when the transformation block is located at the zeroth layer, the value of log2TrafoSize remains unchanged, that is, log2TrafoSize=log2CUSize; when the transformation block is located at the first layer, the value of log2TrafoSize relative to the zeroth layer The value of layer log2TrafoSize minus 1, that is, log2TrafoSize=log2CUSize-1; when the transformation block is in the second layer, the value of log2TrafoSize relative to the first layer log2TrafoSize minus 1, that is, log2TrafoSize=log2CUSize-2; and so on to obtain log2TrafoSize value.
根据前述log2TrafoSize的值获得每一层变换块对应的基本尺寸参数TL, TL的值等于(1<<log2TrafoSize)。在每一层中,2N×N、N×2N和N×N划分方式都有三个候选的变换块尺寸:TL×TL、2TL×0.5TL、0.5TL×2TL,编码端遍历每一种候选的变换块尺寸以确定最优的变换块尺寸。如图1b、1c和1d所示,图像块分别使用2N×N、N×2N和N×N划分方式,其三种候选变换块尺寸为(1<<log2TrafoSize)×(1<<log2TrafoSize)、(1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1))和(1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1))。The basic size parameter TL corresponding to each layer of transformation block is obtained according to the aforementioned value of log2TrafoSize, and the value of TL is equal to (1<<log2TrafoSize). In each layer, the 2N×N, N×2N and N×N division methods have three candidate transform block sizes: TL×TL, 2TL×0.5TL, 0.5TL×2TL, and the encoder traverses each candidate Transform block size to determine optimal transform block size. As shown in Figures 1b, 1c and 1d, the image blocks are divided into 2N×N, N×2N and N×N respectively, and the sizes of the three candidate transform blocks are (1<<log2TrafoSize)×(1<<log2TrafoSize), (1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1)) and (1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1)).
将上述三种候选的变换块尺寸编号。其中,根据划分方式确定一个基准编号对应的变换块尺寸,如2N×N划分方式,其基准编号0对应的变换块尺寸为2TL×0.5TL。然后,确定其余两种变换块尺寸的编号,如2N×N划分方式,TL×TL和0.5TL×2TL变换块尺寸对应的编号分别为1和2。将前述最优的变换块尺寸对应的编号写入码流中。The above three candidate transform block sizes are numbered. Wherein, the transformation block size corresponding to a reference number is determined according to the division method, for example, in the 2N×N division method, the transformation block size corresponding to the reference number 0 is 2TL×0.5TL. Then, determine the numbers of the other two transform block sizes, for example, in the 2N×N division mode, the numbers corresponding to the TL×TL and 0.5TL×2TL transform block sizes are 1 and 2, respectively. Write the number corresponding to the aforementioned optimal transform block size into the code stream.
当图像块使用2N×N划分方式时,图像块倾向于使用2TL×0.5TL变换,因此设2TL×0.5TL对应的编号为0,TL×TL、0.5TL×2TL变换对应的编号分别为1和2.当图像块使用N×2N划分方式时,图像块倾向于使用0.5TL×2TL变换,因此设0.5TL×2TL对应的编号为0,2TL×0.5TL、TL×TL变换对应的编号分别为1和2。当图像块使用N×N划分方式时,图像块倾向于使用TL×TL变换,因此设TL×TL对应的编号为0,2TL×0.5TL、0.5TL×2TL变换对应的编号分别为1和2。When the image block uses 2N×N division method, the image block tends to use 2TL×0.5TL transformation, so the number corresponding to 2TL×0.5TL is set to 0, and the numbers corresponding to TL×TL and 0.5TL×2TL transformation are respectively 1 and 2. When the image block uses the N×2N division method, the image block tends to use 0.5TL×2TL transformation, so the number corresponding to 0.5TL×2TL is set to 0, and the numbers corresponding to 2TL×0.5TL and TL×TL transformation are respectively 1 and 2. When the image block uses the N×N division method, the image block tends to use TL×TL transformation, so the number corresponding to TL×TL is 0, and the numbers corresponding to 2TL×0.5TL and 0.5TL×2TL transformation are 1 and 2 respectively .
解码端为编码端的逆过程。首先,根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值。所述确定图像块对应的变换块log2TrafoSize的数值的方法与上述方法一致。根据log2TrafoSize的数值获得候选的变换块尺寸。然后,解析码流获得变换块尺寸的编号,根据划分方式获得编号对应的变换块尺寸。根据所述编号获得图像块对应的变换块尺寸。The decoding end is the reverse process of the encoding end. First, the value of log2TrafoSize of the transformation block corresponding to the image block is determined according to the division method of the image block. The method for determining the value of the log2TrafoSize of the transformation block corresponding to the image block is consistent with the above method. Obtain the candidate transform block size according to the value of log2TrafoSize. Then, analyze the code stream to obtain the number of the transformation block size, and obtain the transformation block size corresponding to the number according to the division method. The transform block size corresponding to the image block is obtained according to the number.
因此,本发明实施例在进行图像编解码时,从候选变换块尺寸中选择要使用的变换块尺寸,并对所选的变换块尺寸的对应编号进行编码,因此能够选择合适的变换块,提高了图像压缩效率。Therefore, the embodiment of the present invention selects the transform block size to be used from the candidate transform block sizes when performing image encoding and decoding, and encodes the corresponding number of the selected transform block size, so that an appropriate transform block can be selected to improve image compression efficiency.
在另一实施例中,首先确定图像块的尺寸为2M×2M,2M以参数log2CUSize表示,二者关系为2M=1<<log2CUSize,设用于标识变换块尺寸基本信息的参数为log2TrafoSize,log2TrafoSize的初始值为log2CUSize。根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值。In another embodiment, the size of the image block is first determined to be 2M×2M, 2M is represented by the parameter log2CUSize, the relationship between the two is 2M=1<<log2CUSize, and the parameters used to identify the basic information of the transformation block size are log2TrafoSize, log2TrafoSize The initial value of log2CUSize. Determine the value of the transformation block log2TrafoSize corresponding to the image block according to the division method of the image block.
当图像块前述逐层标识的方法确定log2TrafoSize的值时,当变换块位于第零层时,log2TrafoSize的值不变,即log2TrafoSize=log2CUSize;当变换块位于第一层时,log2TrafoSize的相对于第零层log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-1;当变换块位于第二层时,log2TrafoSize的相对于第一层log2TrafoSize的值减一1,即log2TrafoSize=log2CUSize-2;以此类推获得log2TrafoSize的值。When the value of log2TrafoSize is determined by the layer-by-layer identification method of the image block, when the transformation block is located at the zeroth layer, the value of log2TrafoSize remains unchanged, that is, log2TrafoSize=log2CUSize; when the transformation block is located at the first layer, the value of log2TrafoSize relative to the zeroth layer The value of layer log2TrafoSize minus 1, that is, log2TrafoSize=log2CUSize-1; when the transformation block is in the second layer, the value of log2TrafoSize relative to the first layer log2TrafoSize minus 1, that is, log2TrafoSize=log2CUSize-2; and so on to obtain log2TrafoSize value.
根据前述log2TrafoSize的值获得每一层变换块对应的基本尺寸参数TL,TL的值等于(1<<log2TrafoSize)。在每一层中,2N×N、N×2N和N×N划分方式都有三个候选的变换块尺寸:TL×TL、2TL×0.5TL、0.5TL×2TL,编码端遍历每一种候选的变换块尺寸以确定最优的变换块尺寸。如图1b、1c和1d所示,图像块分别使用2N×N、N×2N和N×N划分方式,其三种候选变换块尺寸为(1<<log2TrafoSize)×(1<<log2TrafoSize)、(1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1))和(1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1))。The basic size parameter TL corresponding to each layer of transformation block is obtained according to the aforementioned value of log2TrafoSize, and the value of TL is equal to (1<<log2TrafoSize). In each layer, the 2N×N, N×2N and N×N division methods have three candidate transform block sizes: TL×TL, 2TL×0.5TL, 0.5TL×2TL, and the encoder traverses each candidate Transform block size to determine optimal transform block size. As shown in Figures 1b, 1c and 1d, the image blocks are divided into 2N×N, N×2N and N×N respectively, and the sizes of the three candidate transform blocks are (1<<log2TrafoSize)×(1<<log2TrafoSize), (1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1)) and (1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1)).
将上述候选变换块尺寸进行编号,如(1<<log2TrafoSize)×(1<<log2TrafoSize)、(1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1))和(1<<(log2TrafoSize-1))×(1<<(log2TrafoSize+1))分别对应编号0、1、2,将前述最优的变换块尺寸对应的编号写入码流中。Number the above candidate transform block sizes, such as (1<<log2TrafoSize)×(1<<log2TrafoSize), (1<<(log2TrafoSize+1))×(1<<(log2TrafoSize-1)) and (1<< (log2TrafoSize-1))×(1<<(log2TrafoSize+1)) corresponds to numbers 0, 1, and 2 respectively, and writes the number corresponding to the aforementioned optimal transform block size into the code stream.
解码端为编码端的逆过程。首先,根据图像块的划分方式确定图像块对应的变换块log2TrafoSize的数值。所述确定图像块对应的变换块log2TrafoSize的数值的方法与上述方法一致。根据log2TrafoSize的数值获得候选的变换块尺寸。然后,解析码流获得变换块尺寸的编号,根据所述编号获得图像块对应的变换块尺寸。The decoding end is the reverse process of the encoding end. First, the value of log2TrafoSize of the transformation block corresponding to the image block is determined according to the division method of the image block. The method for determining the value of the log2TrafoSize of the transformation block corresponding to the image block is consistent with the above method. Obtain the candidate transform block size according to the value of log2TrafoSize. Then, the code stream is analyzed to obtain the number of the size of the transformation block, and the size of the transformation block corresponding to the image block is obtained according to the number.
因此,本发明实施例在进行图像编解码时,从候选变换块尺寸中选择要使用的变换块尺寸,并对所选的变换块尺寸的对应编号进行编码,因此能够选择合适的变换块,提高了图像压缩效率。Therefore, the embodiment of the present invention selects the transform block size to be used from the candidate transform block sizes when performing image encoding and decoding, and encodes the corresponding number of the selected transform block size, so that an appropriate transform block can be selected to improve image compression efficiency.
图10是本发明实施例的确定变换块尺寸的设备的框图。图10的设备100包括参数获取单元101和尺寸获取单元102。Fig. 10 is a block diagram of an apparatus for determining a transform block size according to an embodiment of the present invention. The device 100 in FIG. 10 includes a parameter acquisition unit 101 and a size acquisition unit 102 .
参数获取单元101根据图像块信息和图像块的划分方式,获得图像块对应的变换块的参数。尺寸获取单元102根据变换块的参数和图像块的划分方式,获得变换块尺寸。The parameter obtaining unit 101 obtains the parameters of the transformation block corresponding to the image block according to the image block information and the division method of the image block. The size obtaining unit 102 obtains the size of the transform block according to the parameters of the transform block and the division method of the image block.
本发明实施例在确定变换块尺寸时,根据图像块对应的变换块的参数和图像块的划分方式,获得变换块尺寸,因此能够采用适应图像块的划分方式的变换块,提高了图像压缩效率。In the embodiment of the present invention, when determining the size of the transformation block, the size of the transformation block is obtained according to the parameters of the transformation block corresponding to the image block and the division method of the image block, so the transformation block suitable for the division method of the image block can be used, and the image compression efficiency is improved. .
本发明实施例的设备100可执行上述方法的各个过程,为避免重复,不再赘述。例如,参数获取单元101所获得的变换块的参数可包括变换块对应的层数或变换块尺寸的表示值。The device 100 in the embodiment of the present invention can execute each process of the foregoing method, and details are not described again to avoid repetition. For example, the parameters of the transformation block obtained by the parameter acquisition unit 101 may include the number of layers corresponding to the transformation block or an indication value of the size of the transformation block.
另外,尺寸获取单元102在预测块的水平方向尺寸大于竖直方向尺寸时,获得的变换块的水平方向尺寸大于竖直方向尺寸,在预测块的竖直方向尺寸大于水平方向尺寸时,获得的变换块的竖直方向尺寸大于水平方向尺寸,在预测块的水平方向尺寸等于竖直方向尺寸时,获得的变换块的水平方向尺寸等于竖直方向尺寸。In addition, the size obtaining unit 102 obtains a transformed block whose horizontal size is larger than the vertical size when the horizontal size of the predicted block is larger than the vertical size; when the vertical size of the predicted block is larger than the horizontal size, the obtained The vertical size of the transform block is larger than the horizontal size, and when the horizontal size of the prediction block is equal to the vertical size, the horizontal size of the obtained transform block is equal to the vertical size.
图11是本发明一个实施例的图像编码设备的框图。图11的图像编码设备110包括获取单元111、确定单元112和编码单元113。Fig. 11 is a block diagram of an image encoding device of one embodiment of the present invention. The image encoding device 110 of FIG. 11 includes an acquisition unit 111 , a determination unit 112 , and an encoding unit 113 .
获取单元111根据图像块对应的变换块的参数,获得至少一个候选变换块尺寸。确定单元112确定至少一个候选变换块尺寸的编号。编码单元113选择候选变换块尺寸之一,作为图像块对应的变换块的尺寸,并编码变换块的尺寸的编号。The obtaining unit 111 obtains at least one candidate transform block size according to the parameters of the transform block corresponding to the image block. The determination unit 112 determines the number of at least one candidate transform block size. The encoding unit 113 selects one of the candidate transform block sizes as the size of the transform block corresponding to the image block, and encodes the number of the size of the transform block.
因此,本发明实施例在进行图像编码时,从候选变换块尺寸中选择要使用的变换块尺寸,并对所选的变换块尺寸的对应编号进行编码,因此能够选择合适的变换块,提高了图像压缩效率。Therefore, the embodiment of the present invention selects the transform block size to be used from the candidate transform block sizes when performing image encoding, and encodes the corresponding number of the selected transform block size, so that an appropriate transform block can be selected, improving the Image compression efficiency.
本发明实施例的设备110可执行上述方法的各个过程,为避免重复,不再赘述。例如,确定单元112可根据预测块的划分方式,对候选变换块尺寸进行编号。The device 110 in the embodiment of the present invention can execute each process of the foregoing method, and details are not described again to avoid repetition. For example, the determining unit 112 may number the sizes of the candidate transform blocks according to the division manner of the prediction block.
另外,编码单元113可将所选择的候选变换块尺寸对应的编号编码到图像块的码流中。In addition, the encoding unit 113 may encode the number corresponding to the size of the selected candidate transform block into the code stream of the image block.
图12是本发明一个实施例的图像解码设备的框图。图12的图像解码设备120可包括获取单元121、确定单元122和解码单元123。Fig. 12 is a block diagram of an image decoding device of an embodiment of the present invention. The image decoding device 120 of FIG. 12 may include an acquisition unit 121 , a determination unit 122 , and a decoding unit 123 .
获取单元121根据图像块对应的变换块的参数,获得至少一个候选变换块尺寸。确定单元122确定至少一个候选变换块尺寸的编号。解码单元123获得变换块的变换块尺寸的编号,并根据变换块尺寸的编号获得变换块尺寸。The obtaining unit 121 obtains at least one candidate transform block size according to the parameters of the transform block corresponding to the image block. The determination unit 122 determines the serial number of at least one candidate transform block size. The decoding unit 123 obtains the number of the transform block size of the transform block, and obtains the transform block size according to the number of the transform block size.
因此,本发明实施例在进行图像解码时,获得候选变换块尺寸及其编号 的对应关系,从而在获得所使用的变换块尺寸的编号时,可以得到该变换块尺寸,因此能够得到编码端选择的合适的变换块,提高了图像压缩效率。Therefore, in the embodiment of the present invention, when performing image decoding, the corresponding relationship between the size of the candidate transform block and its number is obtained, so that when the number of the used transform block size is obtained, the size of the transform block can be obtained. The appropriate transformation block of the algorithm improves the image compression efficiency.
本发明实施例的设备110可执行上述方法的各个过程,为避免重复,不再赘述。例如,确定单元122可根据预测块的划分方式,对候选变换块尺寸进行编号。The device 110 in the embodiment of the present invention can execute each process of the foregoing method, and details are not described again to avoid repetition. For example, the determining unit 122 may number the sizes of the candidate transform blocks according to the division manner of the prediction block.
另外,解码单元123可解析码流获得所述变换块的变换块尺寸的编号。In addition, the decoding unit 123 can analyze the code stream to obtain the serial number of the transform block size of the transform block.
图12的图像解码设备120的操作可以与图11的图像编码设备相对应。例如,如果编码端将变换块的尺寸的编号编码到图像块的码流中,则解码端可解析该码流获得变换块的变换块尺寸的编号。The operation of the image decoding device 120 of FIG. 12 may correspond to that of the image encoding device of FIG. 11 . For example, if the encoding end encodes the number of the size of the transformation block into the code stream of the image block, the decoding end can parse the code stream to obtain the number of the size of the transformation block.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those skilled in the art can appreciate that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be implemented by electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art may use different methods to implement the described functions for each specific application, but such implementation should not be regarded as exceeding the scope of the present invention.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that for the convenience and brevity of the description, the specific working process of the above-described system, device and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or May be integrated into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Part or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, each unit may exist separately physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions described above are realized in the form of software function units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes. .
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims (40)
Priority Applications (4)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201210019911.XA CN102857755B (en) | 2011-07-01 | 2012-01-21 | The method and apparatus determining transform block size |
| PCT/CN2012/074194 WO2012167670A1 (en) | 2011-07-01 | 2012-04-17 | Method and device for sizing transform block |
| US14/141,201 US9756329B2 (en) | 2011-07-01 | 2013-12-26 | Method and device for determining transform block size |
| US15/656,899 US10542256B2 (en) | 2011-07-01 | 2017-07-21 | Method and device for determining transform block size |
Applications Claiming Priority (4)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201110184380.5 | 2011-07-01 | ||
| CN201110184380 | 2011-07-01 | ||
| CN2011101843805 | 2011-07-01 | ||
| CN201210019911.XA CN102857755B (en) | 2011-07-01 | 2012-01-21 | The method and apparatus determining transform block size |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN102857755A CN102857755A (en) | 2013-01-02 |
| CN102857755B true CN102857755B (en) | 2016-12-14 |
Family
ID=47295461
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201210019911.XA Active CN102857755B (en) | 2011-07-01 | 2012-01-21 | The method and apparatus determining transform block size |
Country Status (3)
| Country | Link |
|---|---|
| US (2) | US9756329B2 (en) |
| CN (1) | CN102857755B (en) |
| WO (1) | WO2012167670A1 (en) |
Families Citing this family (12)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CA2873499A1 (en) | 2012-05-14 | 2013-11-21 | Luca Rossato | Encoding and reconstruction of residual data based on support information |
| US10075266B2 (en) * | 2013-10-09 | 2018-09-11 | Qualcomm Incorporated | Data transmission scheme with unequal code block sizes |
| CN104811731A (en) * | 2014-01-03 | 2015-07-29 | 上海天荷电子信息有限公司 | Multilayer sub-block matching image compression method |
| US9591313B2 (en) * | 2014-03-04 | 2017-03-07 | Vixs Systems, Inc. | Video encoder with transform size preprocessing and methods for use therewith |
| US10715833B2 (en) * | 2014-05-28 | 2020-07-14 | Apple Inc. | Adaptive syntax grouping and compression in video data using a default value and an exception value |
| KR102434480B1 (en) | 2016-02-12 | 2022-08-19 | 삼성전자주식회사 | Video encoding method and apparatus, video decoding method and apparatus |
| EP3349454A1 (en) * | 2017-01-11 | 2018-07-18 | Thomson Licensing | Method and device for coding a block of video data, method and device for decoding a block of video data |
| US11070837B2 (en) * | 2018-04-02 | 2021-07-20 | Panasonic Intellectual Property Corporation Of America | Encoding method, decoding method, encoder, and decoder |
| US11412260B2 (en) * | 2018-10-29 | 2022-08-09 | Google Llc | Geometric transforms for image compression |
| MY189399A (en) * | 2019-03-21 | 2022-02-09 | Samsung Electronics Co Ltd | Method and device for encoding video having block size set for each block shape, and method and device for decoding video |
| US11240501B2 (en) * | 2020-01-08 | 2022-02-01 | Tencent America LLC | L-type partitioning tree |
| CN114187536B (en) * | 2021-12-13 | 2023-03-24 | 苏州方兴信息技术有限公司 | Method and device for determining construction progress, electronic equipment and readable medium |
Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1751511A (en) * | 2003-02-21 | 2006-03-22 | 松下电器产业株式会社 | Image encoding method and image decoding method |
| CN102045560A (en) * | 2009-10-23 | 2011-05-04 | 华为技术有限公司 | Video encoding and decoding method and video encoding and decoding equipment |
Family Cites Families (13)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN101448162B (en) * | 2001-12-17 | 2013-01-02 | 微软公司 | Method for processing video image |
| US8179962B2 (en) | 2004-09-08 | 2012-05-15 | Panasonic Corporation | Motion image encoding method and motion image decoding method |
| KR101088375B1 (en) * | 2005-07-21 | 2011-12-01 | 삼성전자주식회사 | Variable block conversion device and method and image encoding / decoding device and method using same |
| US8483285B2 (en) * | 2008-10-03 | 2013-07-09 | Qualcomm Incorporated | Video coding using transforms bigger than 4×4 and 8×8 |
| EA029414B1 (en) * | 2009-04-08 | 2018-03-30 | Шарп Кабусики Кайся | Video frame encoding apparatus and video frame decoding apparatus |
| WO2010143853A2 (en) * | 2009-06-07 | 2010-12-16 | 엘지전자 주식회사 | Method and apparatus for decoding a video signal |
| KR101885382B1 (en) * | 2009-07-06 | 2018-08-03 | 톰슨 라이센싱 | Methods and apparatus for spatially varying residue coding |
| KR102195687B1 (en) * | 2010-01-12 | 2020-12-28 | 엘지전자 주식회사 | Processing method and device for video signals |
| US9049450B2 (en) * | 2010-04-05 | 2015-06-02 | Samsung Electronics Co., Ltd. | Method and apparatus for encoding video based on internal bit depth increment, and method and apparatus for decoding video based on internal bit depth increment |
| EP4084478B1 (en) * | 2010-09-27 | 2023-11-01 | LG Electronics, Inc. | Method for partitioning block and decoding device |
| US9788019B2 (en) * | 2011-03-09 | 2017-10-10 | Hfi Innovation Inc. | Method and apparatus of transform unit partition with reduced complexity |
| US8964833B2 (en) * | 2011-07-19 | 2015-02-24 | Qualcomm Incorporated | Deblocking of non-square blocks for video coding |
| AU2012326873B2 (en) * | 2011-10-17 | 2015-12-24 | Kt Corporation | Method and apparatus for encoding/decoding image |
-
2012
- 2012-01-21 CN CN201210019911.XA patent/CN102857755B/en active Active
- 2012-04-17 WO PCT/CN2012/074194 patent/WO2012167670A1/en active Application Filing
-
2013
- 2013-12-26 US US14/141,201 patent/US9756329B2/en active Active
-
2017
- 2017-07-21 US US15/656,899 patent/US10542256B2/en active Active
Patent Citations (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1751511A (en) * | 2003-02-21 | 2006-03-22 | 松下电器产业株式会社 | Image encoding method and image decoding method |
| CN102045560A (en) * | 2009-10-23 | 2011-05-04 | 华为技术有限公司 | Video encoding and decoding method and video encoding and decoding equipment |
Also Published As
| Publication number | Publication date |
|---|---|
| CN102857755A (en) | 2013-01-02 |
| US20170332076A1 (en) | 2017-11-16 |
| US10542256B2 (en) | 2020-01-21 |
| US20140177713A1 (en) | 2014-06-26 |
| WO2012167670A1 (en) | 2012-12-13 |
| US9756329B2 (en) | 2017-09-05 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN102857755B (en) | The method and apparatus determining transform block size | |
| CN102957907B (en) | The acquisition methods of a kind of transform block positional information and module | |
| RU2689135C1 (en) | Method and device for encoding video, as well as a method and device for decoding video, supplemented by arithmetic coding | |
| RU2673392C1 (en) | Method and device for entropy video encoding and entropy video decoding method and device | |
| CN108028942B (en) | Pixel prediction method, encoding method, decoding method, device thereof, and storage medium | |
| CN102970526B (en) | A kind of method obtaining transform block size and module | |
| CN104469363B (en) | Method and apparatus for encoding images and method and apparatus for decoding images | |
| CN104902280B (en) | Video decoding apparatus | |
| TWI590649B (en) | Apparatus for arithmetic decoding of video | |
| CN103108177B (en) | Method for encoding images and picture coding device | |
| CN102685487B (en) | Image coding and decoding methods, image coding and decoding equipment and network system | |
| KR20110044487A (en) | Video encoding method and apparatus according to the size of hierarchical coding unit, and video decoding method and apparatus | |
| CN103782595A (en) | Video encoding method, video decoding method and apparatus thereof by intra prediction using checking process for unified reference possibility | |
| CN102761742A (en) | Transform block division method and transform block division parameter coding/decoding method | |
| CN103039073A (en) | Method for encoding/decoding high-resolution image and device for executing the method | |
| CN102857763A (en) | Method and device for decoding based on intra prediction | |
| CN104365100A (en) | Video encoding method and device and video decoding method and device for parallel processing | |
| US20160050426A1 (en) | Lossless-coding-mode video encoding method and device, and decoding method and device | |
| JP2011010156A (en) | Moving image decoding method, and moving image coding method |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| C10 | Entry into substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| C14 | Grant of patent or utility model | ||
| GR01 | Patent grant |