[go: up one dir, main page]

CN106331699B - Image coding method and image encoder - Google Patents

Image coding method and image encoder Download PDF

Info

Publication number
CN106331699B
CN106331699B CN201510346340.4A CN201510346340A CN106331699B CN 106331699 B CN106331699 B CN 106331699B CN 201510346340 A CN201510346340 A CN 201510346340A CN 106331699 B CN106331699 B CN 106331699B
Authority
CN
China
Prior art keywords
prediction mode
coding block
inter
frame
distortion cost
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.)
Expired - Fee Related
Application number
CN201510346340.4A
Other languages
Chinese (zh)
Other versions
CN106331699A (en
Inventor
张宏顺
韩庆瑞
黄立磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201510346340.4A priority Critical patent/CN106331699B/en
Publication of CN106331699A publication Critical patent/CN106331699A/en
Application granted granted Critical
Publication of CN106331699B publication Critical patent/CN106331699B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The present invention provides a kind of image encoding method and image encoder, comprising: encoding block to be encoded is divided into M sub- encoding blocks;The first rate distortion costs value that encoding block corresponds to interframe 2N × 2N prediction mode is obtained, the rate distortion costs value that M sub- encoding blocks respectively correspond to interframe 2N × 2N prediction mode is obtained;Correspond to the rate distortion costs value of interframe 2N × 2N prediction mode according to M sub- encoding blocks, it determines that encoding block corresponds to the first estimated value of the rate distortion costs value of interframe 2N × N prediction mode, and corresponds to the second estimated value of the rate distortion costs value of interframe N × 2N prediction mode;According to the first rate distortion costs value, the first estimated value and the second estimated value, the optimal prediction modes of encoding block are determined;According to the optimal prediction modes of encoding block, predictive coding is carried out to encoding block.Present invention reduces the encoder complexities of image.

Description

图像编码方法和图像编码器Image coding method and image encoder

技术领域technical field

本发明涉及图像编解码领域,更为具体地,涉及一种图像编码方法和图像编码器。The present invention relates to the field of image encoding and decoding, and more particularly, to an image encoding method and an image encoder.

背景技术Background technique

高效视频编码(High Efficiency Video Coding,HEVC)标准协议相比于H.264/AVC,优势非常明显,主观感受相同的情况下,HEVC码流可以减少一半。HEVC编码架构由帧内预测、帧间预测、率失真优化(Rate Distortion Optimization,RDO)、熵编码、环路滤波等模块构成。Compared with H.264/AVC, the high-efficiency video coding (High Efficiency Video Coding, HEVC) standard protocol has obvious advantages. Under the same subjective experience, the HEVC code stream can be reduced by half. The HEVC coding architecture consists of modules such as intra-frame prediction, inter-frame prediction, Rate Distortion Optimization (RDO), entropy coding, and loop filtering.

具体地,在编码时,以最大编单元(Largest Coding Unit,LCU)为单位,将64×64大小的图像块按四叉树结构形式逐层向下划分成4个32×32大小的块、16个16×16大小的块以及64个8×8大小的块。每层中的每个编码块均需要采用多种帧间预测模式和多种帧内预测模式进行预测,并从中找出使得每个编码块的率失真代价值最小的预测模式,作为该编码块的最优预测模式。然后基于每个编码块的最优预测模式,对每个编码块进行预测和编码。Specifically, during encoding, with the largest coding unit (Largest Coding Unit, LCU) as the unit, the image block of size 64×64 is divided into four blocks of size 32×32, 16 blocks of size 16x16 and 64 blocks of size 8x8. Each coding block in each layer needs to use multiple inter prediction modes and multiple intra prediction modes for prediction, and find out the prediction mode that minimizes the rate-distortion cost of each coding block as the coding block. the optimal forecasting model. Each coding block is then predicted and encoded based on the optimal prediction mode for each coding block.

具体地,以非8×8块为例,每个非8×8块可采用多种分割模式(例如,每个非8×8块可包括2N×2N、2N×N、N×2N等分割模式,其中,2N×2N是指对图像块不分割,2N×N是指将图像块分割成上下两个子块,N×2N是指将图像块分割成左右两个子块)对应的帧间预测模式,以及2N×2N分割模式下的35个角度方向对应的帧内预测模式(即需要在每个角度方向上进行一次帧内预测)。对于8×8块而言,每个8×8块采用如下4种分割模式对应的帧间预测模式:2N×2N、2N×N、N×2N和NxN,以及2N×2N和N×N两种分割模式下的各自35个角度方向对应的帧内预测模式。Specifically, taking a non-8×8 block as an example, each non-8×8 block can adopt multiple division modes (for example, each non-8×8 block can include 2N×2N, 2N×N, N×2N, etc. divisions) mode, where 2N×2N means that the image block is not divided, 2N×N means that the image block is divided into upper and lower sub-blocks, and N×2N means that the image block is divided into left and right sub-blocks) corresponding to inter-frame prediction mode, and intra-frame prediction modes corresponding to 35 angular directions in the 2N×2N split mode (that is, intra-frame prediction needs to be performed once in each angular direction). For an 8×8 block, each 8×8 block adopts the inter prediction modes corresponding to the following four partition modes: 2N×2N, 2N×N, N×2N and N×N, and 2N×2N and N×N two Intra prediction modes corresponding to each of the 35 angular directions in each of the split modes.

图1是现有技术中HEVC的编码框架图,下面结合图1进行详细描述。如图1所示,以LCU为单位,对图像块逐层划分后得到4层不同大小的块,其中:FIG. 1 is a coding frame diagram of HEVC in the prior art, which will be described in detail below with reference to FIG. 1 . As shown in Figure 1, taking the LCU as the unit, the image blocks are divided layer by layer to obtain 4 layers of blocks of different sizes, among which:

第0层:对64×64块进行多种分割模式(包括2N×2N、2N×N、N×2N)对应的帧间预测,以及2N×2N分割模式下35个角度方向对应的帧内预测;Layer 0: Perform inter-frame prediction corresponding to multiple division modes (including 2N×2N, 2N×N, N×2N) for 64×64 blocks, and intra-frame prediction corresponding to 35 angular directions in 2N×2N division mode ;

第1层:分别对4个32×32块进行多种分割模式(包括2N×2N、2N×N、N×2N)对应的帧间预测,以及2N×2N分割模式下35个角度方向对应的帧内预测;Layer 1: Perform inter-frame prediction corresponding to multiple partition modes (including 2N×2N, 2N×N, N×2N) for four 32×32 blocks, and 35 angular directions corresponding to the 2N×2N partition mode. Intra prediction;

第2层:分别对16个16×16块进行多种分割模式(包括2N×2N、2N×N、N×2N)对应的帧间预测,以及2N×2N分割模式下35个角度方向对应的帧内预测;Layer 2: Perform inter-frame predictions corresponding to 16 16×16 blocks in various division modes (including 2N×2N, 2N×N, N×2N), and 35 angular directions corresponding to the 2N×2N division mode. Intra prediction;

第3层:分别对64个8×8块进行4种分割模式(2N×2N、2N×N、N×2N、N×N)下的帧间预测,以及2N×2N和N×N两种分割模式下各35个方向对应的帧内预测。Layer 3: Perform inter-frame prediction under 4 partition modes (2N×2N, 2N×N, N×2N, N×N) for 64 8×8 blocks, as well as 2N×2N and N×N Intra prediction corresponding to each 35 directions in split mode.

如上所述,相比H.264/AVC,HEVC编码时,不但块的划分变得复杂,使得编码块的数目增多,而且每个编码块所支持的帧内、帧间预测模式增多。在对图像块进行编码时,需要使用每个编码块对应的所有帧间和帧内预测模式进行预测,并从中选出率失真代价值最小的预测模式最为该编码块的最优预测模式,导致图像编码复杂度高。As mentioned above, compared with H.264/AVC, when HEVC coding, not only the division of blocks becomes more complicated, which increases the number of coding blocks, but also the intra-frame and inter-frame prediction modes supported by each coding block increase. When coding an image block, it is necessary to use all the inter-frame and intra-frame prediction modes corresponding to each coding block for prediction, and select the prediction mode with the smallest rate-distortion cost as the optimal prediction mode for the coding block, resulting in The image coding complexity is high.

发明内容SUMMARY OF THE INVENTION

本发明实施例提供一种图像编码方法和图像编码器,以降低图像编码的复杂度。Embodiments of the present invention provide an image encoding method and an image encoder, so as to reduce the complexity of image encoding.

第一方面,提供一种图像编码方法,包括:将待编码的编码块划分为M个子编码块,所述编码块为所述图像的图像块,所述M为大于等于2的正整数;使用帧间2N×2N预测模式对所述编码块进行预测,并获取所述编码块对应于帧间2N×2N预测模式的第一率失真代价值,使用帧间2N×2N预测模式对所述M个子编码块进行预测,并获取所述M个子编码块中的每个子编码块各自对应于帧间2N×2N预测模式的率失真代价值;根据所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间2N×N预测模式的率失真代价值的第一估计值,以及根据所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间N×2N预测模式的率失真代价值的第二估计值;根据所述第一率失真代价值、所述第一估计值和所述第二估计值,确定所述编码块的最优预测模式;根据所述编码块的最优预测模式,对所述编码块进行预测编码。In a first aspect, an image coding method is provided, including: dividing a coding block to be coded into M sub-coding blocks, where the coding block is an image block of the image, and M is a positive integer greater than or equal to 2; using The inter-frame 2N×2N prediction mode predicts the coding block, and obtains the first rate-distortion cost value of the coding block corresponding to the inter-frame 2N×2N prediction mode, and uses the inter-frame 2N×2N prediction mode to predict the M Predict the sub-coding blocks, and obtain the rate-distortion cost value of each of the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode; according to the M sub-coding blocks corresponding to the inter-frame 2N×2N a rate-distortion cost value of the prediction mode, determining a first estimate of the rate-distortion cost value of the coding block corresponding to the inter 2N×N prediction mode, and determining the rate-distortion cost value corresponding to the inter 2N×2 prediction mode according to the M sub-coding blocks determine the rate-distortion cost value of the coding block corresponding to the inter-frame N×2N prediction mode; according to the first rate-distortion cost value, the first estimated value and the The second estimated value determines the optimal prediction mode of the coding block; and performs predictive coding on the coding block according to the optimal prediction mode of the coding block.

结合第一方面,在第一方面的一种实现方式中,所述M为4,所述M个子编码块包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,所述根据所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间2N×N预测模式的率失真代价值的第一估计值,包括:根据所述左上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右上子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左上子编码块和所述右上子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第三估计值;根据所述左下子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左下子编码块和所述右下子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第四估计值;根据所述第三估计值和所述第四估计值,计算所述第一估计值。With reference to the first aspect, in an implementation manner of the first aspect, the M is 4, and the M sub-coding blocks include an upper-left sub-coding block, an upper-right sub-coding block, a lower-left sub-coding block, and a lower-right sub-coding block, so Determining, according to the rate-distortion cost value of the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode, the first estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame 2N×N prediction mode, including: The upper left sub-coding block is determined according to the rate-distortion cost value of the upper-left sub-coding block corresponding to the inter 2N×2N prediction mode and the rate-distortion cost value of the upper-right sub-coding block corresponding to the inter 2N×2N prediction mode The image block formed with the upper right sub-coding block corresponds to the third estimated value of the rate-distortion cost value of the inter 2N×N prediction mode; according to the lower left sub-coding block corresponding to the rate-distortion of the inter 2N×2N prediction mode The cost value and the lower right sub-coding block correspond to the rate-distortion cost value of the inter-frame 2N×2N prediction mode, and it is determined that the image block composed of the lower-left sub-coding block and the lower-right sub-coding block corresponds to the inter-frame 2N×N prediction a fourth estimate of the rate-distortion cost value of the mode; the first estimate is calculated based on the third estimate and the fourth estimate.

结合第一方面或其上述实现方式的任一种,在第一方面的另一种实现方式中,所述M为4,所述M个子编码块包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,所述根据所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间N×2N预测模式的率失真代价值的第二估计值,包括:根据所述左上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述左下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左上子编码块和所述左下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第五估计值;根据所述右上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述右上子编码块和所述右下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第六估计值;根据所述第五估计值和所述第六估计值,计算所述编码块的所述第二估计值。With reference to the first aspect or any one of the above implementation manners, in another implementation manner of the first aspect, the M is 4, and the M sub-coding blocks include an upper-left sub-coding block, an upper-right sub-coding block, and a lower-left sub-coding block. The sub-coding block and the lower-right sub-coding block, the rate-distortion value of the coding block corresponding to the inter-frame N×2N prediction mode is determined according to the rate-distortion cost value of the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode The second estimated value of the cost value includes: the rate-distortion cost value corresponding to the inter-frame 2N×2N prediction mode of the upper left sub-coding block and the rate-distortion value of the lower left sub-coding block corresponding to the inter-frame 2N×2N prediction mode The cost value is to determine the fifth estimated value of the rate-distortion cost value of the image block composed of the upper left sub-coding block and the lower left sub-coding block corresponding to the inter-frame N×2N prediction mode; according to the upper right sub-coding block corresponding to The rate-distortion cost value of the inter-frame 2N×2N prediction mode and the rate-distortion cost value of the lower-right sub-coding block corresponding to the inter-frame 2N×2N prediction mode are determined to determine the composition of the upper-right sub-coding block and the lower-right sub-coding block. The image block corresponds to a sixth estimate of the rate-distortion cost value of the inter N×2N prediction mode; the second estimate of the coding block is calculated based on the fifth estimate and the sixth estimate.

结合第一方面或其上述实现方式的任一种,在第一方面的另一种实现方式中,所述根据所述第一率失真代价值、所述第一估计值和所述第二估计值,确定所述编码块的最优预测模式,包括:确定所述第一率失真代价值、所述第一估计值和所述第二估计值中的最小值;当所述最小值对应的帧间预测模式为帧间2N×2N预测模式时,将帧间2N×2N预测模式作为所述编码块的最优帧间预测模式;根据所述最优帧间预测模式,确定所述编码块的最优预测模式。With reference to the first aspect or any one of the foregoing implementation manners, in another implementation manner of the first aspect, the first rate-distortion cost value, the first estimated value, and the second estimated value, and determining the optimal prediction mode for the coding block includes: determining the minimum value among the first rate-distortion cost value, the first estimated value, and the second estimated value; when the minimum value corresponds to When the inter-frame prediction mode is the inter-frame 2N×2N prediction mode, the inter-frame 2N×2N prediction mode is used as the optimal inter-frame prediction mode of the coding block; according to the optimal inter-frame prediction mode, the coding block is determined the optimal forecasting model.

结合第一方面或其上述实现方式的任一种,在第一方面的另一种实现方式中,所述根据所述第一率失真代价值、所述第一估计值和所述第二估计值,确定所述编码块的最优预测模式,包括:确定所述第一率失真代价值、所述第一估计值和所述第二估计值中的最小值;当所述最小值对应的目标帧间预测模式为帧间2N×N预测模式或帧间N×2N预测模式时,使用所述目标帧间预测模式对所述编码块进行预测,并获得所述编码块对应于所述目标帧间预测模式的第二率失真代价值;将所述第一率失真代价值和所述第二率失真代价值中的较小值对应的帧间预测模式作为所述编码块的最优帧间预测模式;根据所述最优帧间预测模式,确定所述编码块的最优预测模式。With reference to the first aspect or any one of the foregoing implementation manners, in another implementation manner of the first aspect, the first rate-distortion cost value, the first estimated value, and the second estimated value, and determining the optimal prediction mode for the coding block includes: determining the minimum value among the first rate-distortion cost value, the first estimated value, and the second estimated value; when the minimum value corresponds to When the target inter-frame prediction mode is the inter-frame 2N×N prediction mode or the inter-frame N×2N prediction mode, use the target inter-frame prediction mode to predict the coding block, and obtain that the coding block corresponds to the target The second rate-distortion cost value of the inter-frame prediction mode; the inter-frame prediction mode corresponding to the smaller of the first rate-distortion cost value and the second rate-distortion cost value is taken as the optimal frame of the coding block inter prediction mode; according to the optimal inter prediction mode, determine the optimal prediction mode of the coding block.

结合第一方面或其上述实现方式的任一种,在第一方面的另一种实现方式中,所述根据所述编码块的最优帧间预测模式,确定所述编码块的最优预测模式,包括:当所述编码块对应于所述最优帧间预测模式的率失真代价值小于或等于预设阈值时,将所述最优帧间预测模式作为所述最优预测模式;或者,当所述编码块对应于所述最优帧间预测模式的率失真代价值大于所述预设阈值时,使用帧内预测模式对所述编码块进行预测,并获取所述编码块对应于帧内预测模式的第三率失真代价值,将所述编码块对应于所述最优帧间预测模式的率失真代价值和所述第三率失真代价值中的较小值对应的预测模式作为所述编码块的最优预测模式。With reference to the first aspect or any one of the above implementation manners, in another implementation manner of the first aspect, the optimal prediction of the coding block is determined according to the optimal inter-frame prediction mode of the coding block mode, including: when the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is less than or equal to a preset threshold, using the optimal inter-frame prediction mode as the optimal prediction mode; or , when the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is greater than the preset threshold, use the intra-frame prediction mode to predict the coding block, and obtain the coding block corresponding to The third rate-distortion cost value of the intra-frame prediction mode, the coding block corresponds to the prediction mode corresponding to the smaller value of the rate-distortion cost value of the optimal inter-frame prediction mode and the third rate-distortion cost value as the optimal prediction mode for the coding block.

结合第一方面或其上述实现方式的任一种,在第一方面的另一种实现方式中,所述根据所述编码块的最优帧间预测模式,确定所述编码块的最优预测模式,包括:当所述M个子编码块的最优预测模式均为帧间预测模式时,将所述最优帧间预测模式确定为所述编码块的最优预测模式;或者,当所述M个子编码块中存在最优预测模式为帧内预测模式的子编码块时,使用帧内预测模式对所述编码块进行预测,并获取所述编码块对应于帧内预测模式的第三率失真代价值,将所述编码块对应于所述最优帧间预测模式的率失真代价值和所述第三率失真代价值中的较小值对应的预测模式作为所述编码块的最优预测模式。With reference to the first aspect or any one of the above implementation manners, in another implementation manner of the first aspect, the optimal prediction of the coding block is determined according to the optimal inter-frame prediction mode of the coding block mode, including: when the optimal prediction modes of the M sub-coding blocks are all inter-frame prediction modes, determining the optimal inter-frame prediction mode as the optimal prediction mode of the coding block; or, when the When there is a sub-coding block whose optimal prediction mode is the intra-frame prediction mode among the M sub-coding blocks, use the intra-frame prediction mode to predict the coding block, and obtain the third rate of the coding block corresponding to the intra-frame prediction mode Distortion cost value, taking the prediction mode corresponding to the smaller of the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode and the third rate-distortion cost value as the optimal value of the coding block forecast mode.

第二方面,提供一种图像编码器,包括:划分模块,用于将待编码的编码块划分为M个子编码块,所述编码块为所述图像的图像块,所述M为大于等于2的正整数;获取模块,用于使用帧间2N×2N预测模式对所述编码块进行预测,并获取所述编码块对应于帧间2N×2N预测模式的第一率失真代价值,使用帧间2N×2N预测模式对所述划分模块划分得到的所述M个子编码块进行预测,并获取所述M个子编码块中的每个子编码块各自对应于帧间2N×2N预测模式的率失真代价值;第一确定模块,用于根据所述获取模块获取到的所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间2N×N预测模式的率失真代价值的第一估计值,以及根据所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间N×2N预测模式的率失真代价值的第二估计值;第二确定模块,用于根据所述获取模块获取到的所述第一率失真代价值、所述第一确定模块确定的所述第一估计值和所述第二估计值,确定所述编码块的最优预测模式;编码模块,用于根据所述第二确定模块确定的所述编码块的最优预测模式,对所述编码块进行预测编码。In a second aspect, an image encoder is provided, comprising: a division module configured to divide a coding block to be coded into M sub-coding blocks, where the coding block is an image block of the image, and M is greater than or equal to 2 A positive integer of The inter 2N×2N prediction mode performs prediction on the M sub-coding blocks divided by the dividing module, and obtains the rate-distortion of each sub-coding block in the M sub-coding blocks corresponding to the inter 2N×2N prediction mode. a cost value; a first determining module, configured to determine, according to the rate-distortion cost value of the M sub-coding blocks obtained by the obtaining module, corresponding to the inter-frame 2N×2N prediction mode, determine that the coding block corresponds to the inter-frame 2N×2N prediction mode a first estimate of the rate-distortion cost value of the N prediction mode, and determining that the coding block corresponds to the inter-frame N×2N prediction based on the rate-distortion cost value of the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode a second estimated value of the rate-distortion cost value of the mode; a second determination module, configured to use the first rate-distortion cost value acquired by the acquiring module and the first estimated value determined by the first determining module and the second estimated value to determine the optimal prediction mode of the coding block; the coding module is configured to predict the coding block according to the optimal prediction mode of the coding block determined by the second determining module coding.

结合第二方面,在第二方面的一种实现方式中,所述M为4,所述M个子编码块包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,所述第一确定模块具体用于根据所述左上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右上子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左上子编码块和所述右上子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第三估计值;根据所述左下子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左下子编码块和所述右下子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第四估计值;根据所述第三估计值和所述第四估计值,计算所述第一估计值。With reference to the second aspect, in an implementation manner of the second aspect, the M is 4, and the M sub-coding blocks include an upper-left sub-coding block, an upper-right sub-coding block, a lower-left sub-coding block, and a lower-right sub-coding block, so The first determining module is specifically configured to, according to the rate-distortion cost value of the upper left sub-coding block corresponding to the inter 2N×2N prediction mode and the rate-distortion cost value of the upper right sub-coding block corresponding to the inter 2N×2N prediction mode , determine that the image block composed of the upper left sub-coding block and the upper right sub-coding block corresponds to the third estimated value of the rate-distortion cost value of the inter-frame 2N×N prediction mode; The rate-distortion cost value of the 2N×2N prediction mode and the rate-distortion cost value of the lower right sub-coding block corresponding to the inter-frame 2N×2N prediction mode, determine the image block composed of the lower-left sub-coding block and the lower-right sub-coding block a fourth estimated value of the rate-distortion cost value corresponding to the inter 2N×N prediction mode; the first estimated value is calculated according to the third estimated value and the fourth estimated value.

结合第二方面或其上述实现方式的任一种,在第二方面的另一种实现方式中,所述M为4,所述M个子编码块包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,所述第一确定模块具体用于根据所述左上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述左下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左上子编码块和所述左下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第五估计值;根据所述右上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述右上子编码块和所述右下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第六估计值;根据所述第五估计值和所述第六估计值,计算所述编码块的所述第二估计值。With reference to the second aspect or any of the foregoing implementation manners, in another implementation manner of the second aspect, the M is 4, and the M sub-coding blocks include an upper-left sub-coding block, an upper-right sub-coding block, and a lower-left sub-coding block. a sub-coding block and a lower-right sub-coding block, the first determining module is specifically configured to, according to the rate-distortion cost value of the upper-left sub-coding block corresponding to the inter-frame 2N×2N prediction mode and the lower-left sub-coding block corresponding to the inter-frame The rate-distortion cost value of the 2N×2N prediction mode is determined, and the image block formed by the upper left sub-coding block and the lower left sub-coding block corresponds to the fifth estimated value of the rate-distortion cost value of the inter-frame N×2N prediction mode; according to The upper right sub-coding block corresponds to the rate-distortion cost value of the inter-frame 2N×2N prediction mode and the lower-right sub-coding block corresponds to the rate-distortion cost value of the inter-frame 2N×2N prediction mode, determine the upper right sub-coding block and The image block formed by the lower right sub-coding block corresponds to the sixth estimated value of the rate-distortion cost value of the inter-frame N×2N prediction mode; the coding block is calculated according to the fifth estimated value and the sixth estimated value the second estimate of .

结合第二方面或其上述实现方式的任一种,在第二方面的另一种实现方式中,所述第二确定模块具体用于确定所述第一率失真代价值、所述第一估计值和所述第二估计值中的最小值;当所述最小值对应的帧间预测模式为帧间2N×2N预测模式时,将帧间2N×2N预测模式作为所述编码块的最优帧间预测模式;根据所述最优帧间预测模式,确定所述编码块的最优预测模式。With reference to the second aspect or any one of the foregoing implementation manners, in another implementation manner of the second aspect, the second determination module is specifically configured to determine the first rate-distortion cost value, the first estimate value and the minimum value of the second estimated value; when the inter-frame prediction mode corresponding to the minimum value is the inter-frame 2N×2N prediction mode, the inter-frame 2N×2N prediction mode is used as the optimal coding block inter-frame prediction mode; according to the optimal inter-frame prediction mode, determine the optimal prediction mode of the coding block.

结合第二方面或其上述实现方式的任一种,在第二方面的另一种实现方式中,所述第二确定模块具体用于确定所述第一率失真代价值、所述第一估计值和所述第二估计值中的最小值;当所述最小值对应的目标帧间预测模式为帧间2N×N预测模式或帧间N×2N预测模式时,使用所述目标帧间预测模式对所述编码块进行预测,并获得所述编码块对应于所述目标帧间预测模式的第二率失真代价值;将所述第一率失真代价值和所述第二率失真代价值中的较小值对应的帧间预测模式作为所述编码块的最优帧间预测模式;根据所述最优帧间预测模式,确定所述编码块的最优预测模式。With reference to the second aspect or any one of the foregoing implementation manners, in another implementation manner of the second aspect, the second determination module is specifically configured to determine the first rate-distortion cost value, the first estimate value and the minimum value of the second estimated value; when the target inter-frame prediction mode corresponding to the minimum value is an inter-frame 2N×N prediction mode or an inter-frame N×2N prediction mode, the target inter-frame prediction mode is used mode to predict the coding block, and obtain the second rate-distortion cost value of the coding block corresponding to the target inter-frame prediction mode; the first rate-distortion cost value and the second rate-distortion cost value are The inter-frame prediction mode corresponding to the smaller value in is used as the optimal inter-frame prediction mode of the coding block; the optimal inter-frame prediction mode of the coding block is determined according to the optimal inter-frame prediction mode.

结合第二方面或其上述实现方式的任一种,在第二方面的另一种实现方式中,所述第二确定模块具体用于当所述编码块对应于所述最优帧间预测模式的率失真代价值小于或等于预设阈值时,将所述最优帧间预测模式作为所述最优预测模式;或者,当所述编码块对应于所述最优帧间预测模式的率失真代价值大于所述预设阈值时,使用帧内预测模式对所述编码块进行预测,并获取所述编码块对应于帧内预测模式的第三率失真代价值,将所述编码块对应于所述最优帧间预测模式的率失真代价值和所述第三率失真代价值中的较小值对应的预测模式作为所述编码块的最优预测模式。With reference to the second aspect or any one of the above implementation manners, in another implementation manner of the second aspect, the second determining module is specifically configured to, when the coding block corresponds to the optimal inter-frame prediction mode When the rate-distortion cost value is less than or equal to a preset threshold, the optimal inter-frame prediction mode is used as the optimal prediction mode; or, when the coding block corresponds to the rate-distortion rate of the optimal inter-frame prediction mode When the cost value is greater than the preset threshold, use the intra-frame prediction mode to predict the coding block, obtain the third rate-distortion cost value of the coding block corresponding to the intra-frame prediction mode, and set the coding block corresponding to the intra-frame prediction mode. The prediction mode corresponding to the smaller of the rate-distortion cost value of the optimal inter-frame prediction mode and the third rate-distortion cost value is used as the optimal prediction mode of the coding block.

结合第二方面或其上述实现方式的任一种,在第二方面的另一种实现方式中,所述第二确定模块具体用于当所述M个子编码块的最优预测模式均为帧间预测模式时,将所述最优帧间预测模式确定为所述编码块的最优预测模式;或者,当所述M个子编码块中存在最优预测模式为帧内预测模式的子编码块时,使用帧内预测模式对所述编码块进行预测,并获取所述编码块对应于帧内预测模式的第三率失真代价值,将所述编码块对应于所述最优帧间预测模式的率失真代价值和所述第三率失真代价值中的较小值对应的预测模式作为所述编码块的最优预测模式。With reference to the second aspect or any one of the above implementation manners, in another implementation manner of the second aspect, the second determining module is specifically configured to be used when the optimal prediction modes of the M sub-coding blocks are frame When the inter prediction mode is used, the optimal inter prediction mode is determined as the optimal prediction mode of the coding block; or, when there is a sub coding block whose optimal prediction mode is the intra prediction mode in the M sub coding blocks when the intra-frame prediction mode is used to predict the coding block, and the third rate-distortion cost value of the coding block corresponding to the intra-frame prediction mode is obtained, and the coding block is corresponding to the optimal inter-frame prediction mode The prediction mode corresponding to the smaller of the rate-distortion cost value and the third rate-distortion cost value is used as the optimal prediction mode of the coding block.

本发明实施例将编码块划分成M个子编码块,分别获取该编码块和该M个子编码块对应于帧间2N×2N预测模式的率失真代价值,根据该M个子编码块的率失真代价值确定该编码块对应于帧间2N×N预测模式的率失真代价值的估计值,以及该编码块对应于帧间N×2N预测模式的率失真代价值的估计值,根据获取到的该编码块的率失真代价值以及确定出的该编码块的率失真代价值的估计值,确定该编码块的最优预测模式,无需像现有技术那样使用所有预测模式对该编码块进行预测以选出该编码块的最优预测模式,从而降低了图像的编码复杂度。The embodiment of the present invention divides the coding block into M sub-coding blocks, obtains the rate-distortion cost values of the coding block and the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode, and obtains the rate-distortion cost values of the M sub-coding blocks according to the rate-distortion generation of the M sub-coding blocks. The value determines the estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame 2N×N prediction mode, and the estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame N×2N prediction mode. The rate-distortion cost value of the coding block and the determined estimated value of the rate-distortion cost value of the coding block, determine the optimal prediction mode of the coding block, and it is not necessary to use all prediction modes to predict the coding block as in the prior art. The optimal prediction mode of the coding block is selected, thereby reducing the coding complexity of the image.

附图说明Description of drawings

为了更清楚地说明本发明实施例的技术方案,下面将对本发明实施例中所需要使用的附图作简单地介绍,显而易见地,下面所描述的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions of the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings that need to be used in the embodiments of the present invention. Obviously, the drawings described below are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.

图1是现有技术中HEVC的编码框架图。FIG. 1 is a coding frame diagram of HEVC in the prior art.

图2是本发明实施例的图像编码方法的示意性流程图。FIG. 2 is a schematic flowchart of an image coding method according to an embodiment of the present invention.

图3是编码块划分成4个子编码块的示例图。FIG. 3 is a diagram illustrating an example of division of a coding block into 4 sub-coding blocks.

图4是编码块按照2N×N分割模式的示例图。FIG. 4 is an example diagram of an encoding block according to a 2N×N partition mode.

图5是编码块按照N×2N分割模式划分的示例图。FIG. 5 is an example diagram of division of coding blocks according to an N×2N partition mode.

图6是本发明实施例的图像编码流程的示例图。FIG. 6 is an exemplary diagram of an image encoding process according to an embodiment of the present invention.

图7是本发明实施例的图像编码流程的示例图。FIG. 7 is an exemplary diagram of an image encoding process according to an embodiment of the present invention.

图8是子块组合方式的示意图。FIG. 8 is a schematic diagram of a sub-block combining manner.

图9是本发明实施例的基于帧间计算结果判断是否继续执行帧内计算的示意性流程图。FIG. 9 is a schematic flowchart of judging whether to continue performing intra-frame calculation based on an inter-frame calculation result according to an embodiment of the present invention.

图10是本发明实施例的基于帧间计算结果判断是否继续执行帧内计算的示意性流程图。FIG. 10 is a schematic flowchart of judging whether to continue performing intra-frame calculation based on an inter-frame calculation result according to an embodiment of the present invention.

图11是本发明实施例的图像编码器的示意性结构图。FIG. 11 is a schematic structural diagram of an image encoder according to an embodiment of the present invention.

图12是本发明实施例的图像编码器的示意性结构图。FIG. 12 is a schematic structural diagram of an image encoder according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明的一部分实施例,而不是全部实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都应属于本发明保护的范围。The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, but not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.

图2是本发明实施例的图像编码方法的示意性流程图。图2的方法包括:FIG. 2 is a schematic flowchart of an image coding method according to an embodiment of the present invention. The method of Figure 2 includes:

210、将待编码的编码块划分为M个子编码块,编码块为图像的图像块,所述M为大于等于2的正整数。210. Divide the coding block to be coded into M sub-coding blocks, where the coding block is an image block of an image, and M is a positive integer greater than or equal to 2.

应理解,上述编码块和上述子编码块的形状均可以是正方形。It should be understood that the shapes of the above coding blocks and the above sub-coding blocks may be squares.

本发明实施例的图像编码方法可以应用于HEVC的编码架构中,具体而言,在HEVC架构中,首先会基于LCU,以四叉树形式对图像块进行划分,得到多层编码块。例如,LCU的尺寸可以为64×64,将64×64大小的图像块作为第0层的编码块(或称编码单元),然后将第0层的编码块以四叉树的形式进行划分,得到位于第1层的4个32×32大小的编码块,接着将第1层的4个32×32大小的编码块分别以四叉树的形式进行划分,得到位于第2层的16个16×16大小的编码块,接着将第2层的16个16×16大小的编码块分别以四叉树的形式进行划分,得到位于第3层的64个8×8大小的编码块,而步骤210中的编码块可以是上述第0层至第3层中的任一层中的编码块,上述编码块的M个子块可指该编码块以四叉树的形式划分而成的4个子编码块。The image coding method according to the embodiment of the present invention can be applied to the HEVC coding architecture. Specifically, in the HEVC architecture, the image block is firstly divided in the form of a quadtree based on the LCU to obtain a multi-layer coding block. For example, the size of the LCU can be 64×64, and the 64×64 image block is used as the coding block (or coding unit) of the 0th layer, and then the coding block of the 0th layer is divided in the form of a quadtree, Obtain four 32×32-sized coding blocks located in the first layer, and then divide the four 32×32-sized encoding blocks in the first layer in the form of a quadtree, to obtain 16 16 blocks located in the second layer ×16 coding blocks, and then divide the 16 16 × 16 coding blocks of the second layer in the form of quadtrees to obtain 64 8 × 8 coding blocks located in the third layer, and the step The coding block in 210 may be a coding block in any of the above-mentioned layers 0 to 3, and the M sub-blocks of the above-mentioned coding block may refer to 4 sub-codings that are divided into the coding block in the form of a quadtree. piece.

220、使用帧间2N×2N预测模式对编码块进行预测,并获取编码块对应于帧间2N×2N预测模式的第一率失真代价值,使用帧间2N×2N预测模式对M个子编码块进行预测,并获取M个子编码块中的每个子编码块各自对应于帧间2N×2N预测模式的率失真代价值。220. Use the inter-frame 2N×2N prediction mode to predict the coding block, obtain the first rate-distortion cost value of the coding block corresponding to the inter-frame 2N×2N prediction mode, and use the inter-frame 2N×2N prediction mode to predict the M sub-coding blocks. Prediction is performed, and the rate-distortion cost value of each of the M sub-coding blocks corresponding to the inter 2N×2N prediction mode is obtained.

需要说明的是,编码块可包括帧间2N×2N预测模式、帧间N×2N预测模式以及帧间2N×N预测模式。所谓帧间2N×2N预测模式可指在2N×2N分割模式下进行帧间预测,即对图像块不进行分割直接进行帧间预测;同理,帧间2N×N预测模式可指在2N×N分割模式下进行帧间预测,即将图像块分割成上下两个子块后进行帧间预测;同理,帧间N×2N预测模式可指在N×2N分割模式下进行帧间预测,即将图像块分割成左右两个子块后进行帧间预测。It should be noted that the coding block may include an inter 2N×2N prediction mode, an inter N×2N prediction mode, and an inter 2N×N prediction mode. The so-called inter-frame 2N×2N prediction mode can refer to the inter-frame prediction in the 2N×2N segmentation mode, that is, the inter-frame prediction is performed directly without dividing the image block; Inter-frame prediction is performed in the N partition mode, that is, the image block is divided into upper and lower sub-blocks to perform inter-frame prediction; similarly, the inter-frame N×2N prediction mode can refer to the inter-frame prediction in the N×2N partition mode, that is, the image The block is divided into left and right sub-blocks for inter prediction.

230、根据M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定编码块对应于帧间2N×N预测模式的率失真代价值的第一估计值,以及根据M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定编码块对应于帧间N×2N预测模式的率失真代价值的第二估计值。230. Determine, according to the rate-distortion cost value of the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode, a first estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame 2N×N prediction mode, and according to the M sub-coding blocks The block corresponds to the rate-distortion cost value of the inter 2Nx2N prediction mode, and a second estimate of the rate-distortion cost value of the coded block corresponding to the inter Nx2N prediction mode is determined.

以M个子编码块为4个子编码块为例进行举例说明。如图3所示,该4个子块包括子块0、子块1、子块2和子块3。帧间2N×N预测模式是将编码块分割成上下两个子块后进行帧间预测,如图4所示,该上下两个子块可以分别为上边块0和下边块1;同理,帧间N×2N预测模式是将编码块分割成左右两个子块后进行帧间预测,如图5所示,该左右两个子块可以分别为左边块0和右边块1。本发明实施例可以利用图4、图5所示的子块与图3所示的子块之间的相互包含关系对编码块在帧间N×2N预测模式和帧间2N×N预测模式下的率失真代价值进行估计,后文会结合具体的实施例进行详细的描述。An example is given by taking M sub-coding blocks as 4 sub-coding blocks as an example. As shown in FIG. 3 , the four sub-blocks include sub-block 0, sub-block 1, sub-block 2 and sub-block 3. The inter-frame 2N×N prediction mode is to perform inter-frame prediction after dividing the coding block into upper and lower sub-blocks. As shown in Figure 4, the upper and lower sub-blocks can be upper block 0 and lower block 1 respectively; The N×2N prediction mode is to perform inter-frame prediction after dividing the coding block into left and right sub-blocks. As shown in FIG. 5 , the left and right sub-blocks may be left block 0 and right block 1 respectively. In this embodiment of the present invention, the sub-blocks shown in FIG. 4 and FIG. 5 and the sub-blocks shown in The rate-distortion cost value is estimated, which will be described in detail later in conjunction with specific embodiments.

240、根据第一率失真代价值、第一估计值和第二估计值,确定编码块的最优预测模式。240. Determine an optimal prediction mode for the coding block according to the first rate-distortion cost value, the first estimated value, and the second estimated value.

步骤240的实现方式可以有多种,例如,可以从第一率失真代价值、第一估计值和第二估计值中选取最小值,然后将该最小值对应的预测模式确定为上述最优预测模式;或者,将该最小值对应的预测模式确定为最优的帧间预测模式,然后再将该最小值与该编码块的帧内预测模式的率失真代价值进行比较,得出上述最优预测模式。There can be various implementations of step 240. For example, the minimum value can be selected from the first rate-distortion cost value, the first estimated value, and the second estimated value, and then the prediction mode corresponding to the minimum value is determined as the above-mentioned optimal prediction. or, determine the prediction mode corresponding to the minimum value as the optimal inter-frame prediction mode, and then compare the minimum value with the rate-distortion cost value of the intra-frame prediction mode of the coding block to obtain the above optimal forecast mode.

250、根据编码块的最优预测模式,对编码块进行预测编码。250. Perform predictive coding on the coding block according to the optimal prediction mode of the coding block.

本发明实施例将编码块划分成M个子编码块,分别获取该编码块和该M个子编码块对应于帧间2N×2N预测模式的率失真代价值,根据该M个子编码块的率失真代价值确定该编码块对应于帧间2N×N预测模式的率失真代价值的估计值,以及该编码块对应于帧间N×2N预测模式的率失真代价值的估计值,根据获取到的该编码块的率失真代价值以及确定出的该编码块的率失真代价值的估计值,确定该编码块的最优预测模式,无需像现有技术那样使用所有预测模式对该编码块进行预测以选出该编码块的最优预测模式,从而降低了图像的编码复杂度。The embodiment of the present invention divides the coding block into M sub-coding blocks, obtains the rate-distortion cost values of the coding block and the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode, and obtains the rate-distortion cost values of the M sub-coding blocks according to the rate-distortion generation of the M sub-coding blocks. The value determines the estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame 2N×N prediction mode, and the estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame N×2N prediction mode. The rate-distortion cost value of the coding block and the determined estimated value of the rate-distortion cost value of the coding block, determine the optimal prediction mode of the coding block, and it is not necessary to use all prediction modes to predict the coding block as in the prior art. The optimal prediction mode of the coding block is selected, thereby reducing the coding complexity of the image.

可选地,作为一个实施例,M可以为4,M个子编码块可包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,步骤230可包括:根据左上子编码块对应于帧间2N×2N预测模式的率失真代价值和右上子编码块对应于帧间2N×2N预测模式的率失真代价值,确定左上子编码块和右上子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第三估计值;根据左下子编码块对应于帧间2N×2N预测模式的率失真代价值和右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定左下子编码块和右下子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第四估计值;根据第三估计值和第四估计值,计算第一估计值。Optionally, as an embodiment, M may be 4, and the M sub-coding blocks may include an upper-left sub-coding block, an upper-right sub-coding block, a lower-left sub-coding block, and a lower-right sub-coding block. Step 230 may include: according to the upper-left sub-coding block The rate-distortion cost value corresponding to the inter-frame 2N×2N prediction mode and the rate-distortion cost value of the upper right sub-coding block corresponding to the inter-frame 2N×2N prediction mode, it is determined that the image block composed of the upper-left sub-coding block and the upper-right sub-coding block corresponds to The third estimate of the rate-distortion cost value of the inter 2N×N prediction mode; according to the rate-distortion cost value of the lower left sub-coding block corresponding to the inter 2N×2N prediction mode and the lower right sub-coding block corresponding to the inter 2N×2N prediction The rate-distortion cost value of the mode is determined, and the image block composed of the lower left sub-coding block and the lower right sub-coding block corresponds to the fourth estimated value of the rate-distortion cost value of the inter-frame 2N×N prediction mode; according to the third estimated value and the fourth estimated value value, calculate the first estimate.

参考图3和图4,可以对图3中的左上子编码块0对应于帧间2N×2N预测模式的率失真代价值cost_0和右上子编码块1对应于帧间2N×2N预测模式的率失真代价值cost_1加权求和,得出图4中的上边块0的率失真代价值的第三估计值;可以对图3中的左下子编码块2对应于帧间2N×2N预测模式的率失真代价值cost_2和右下子编码块3对应于帧间2N×2N预测模式的率失真代价值cost_3加权求和,得出图4中的下边块1的率失真代价值的第四估计值。3 and 4 , the rate-distortion cost value cost_0 of the upper left sub-coding block 0 corresponding to the inter 2N×2N prediction mode and the upper right sub-coding block 1 corresponding to the rate of the inter 2N×2N prediction mode in FIG. The distortion cost value cost_1 is weighted and summed to obtain the third estimate of the rate-distortion cost value of the upper block 0 in FIG. 4; the rate of the lower left sub-coding block 2 in FIG. The distortion cost value cost_2 and the rate-distortion cost value cost_3 of the lower right sub-coding block 3 corresponding to the inter-frame 2N×2N prediction mode are weighted and summed to obtain a fourth estimate of the rate-distortion cost value of the lower block 1 in FIG. 4 .

可选地,作为一个实施例,M可以为4,M个子编码块包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,步骤230可包括:根据左上子编码块对应于帧间2N×2N预测模式的率失真代价值和左下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定左上子编码块和左下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第五估计值;根据右上子编码块对应于帧间2N×2N预测模式的率失真代价值和右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定右上子编码块和右下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第六估计值;根据第五估计值和第六估计值,计算编码块的第二估计值。Optionally, as an embodiment, M may be 4, and the M sub-coding blocks include an upper-left sub-coding block, an upper-right sub-coding block, a lower-left sub-coding block, and a lower-right sub-coding block. Step 230 may include: according to the correspondence between the upper-left sub-coding blocks Based on the rate-distortion cost value of the inter-frame 2N×2N prediction mode and the rate-distortion cost value of the lower-left sub-coding block corresponding to the inter-frame 2N×2N prediction mode, it is determined that the image block composed of the upper-left sub-coding block and the lower-left sub-coding block corresponds to the frame The fifth estimate of the rate-distortion cost value of the inter-N×2N prediction mode; according to the rate-distortion cost value of the upper right sub-coding block corresponding to the inter 2N×2N prediction mode and the lower right sub-coding block corresponding to the inter 2N×2N prediction mode The rate-distortion cost value is determined, and the image block composed of the upper right sub-coding block and the lower-right sub-coding block corresponds to the sixth estimated value of the rate-distortion cost value of the inter-frame N×2N prediction mode; according to the fifth estimated value and the sixth estimated value , calculate the second estimate of the coded block.

参考图3和图5,可以对图3中的左上子编码块0对应于帧间2N×2N预测模式的率失真代价值cost_0和左下子编码块2对应于帧间2N×2N预测模式的率失真代价值cost_2加权求和,得出图5中的左边块0的率失真代价值的第五估计值;可以将图3中的右上子编码块1对应于帧间2N×2N预测模式的率失真代价值cost_1和右下子编码块3对应于帧间2N×2N预测模式的率失真代价值cost_3加权求和,得出图5中的右边块1的率失真代价值的第六估计值。3 and 5 , the rate-distortion cost value cost_0 of the upper left sub-coding block 0 corresponding to the inter 2N×2N prediction mode and the lower left sub-coding block 2 corresponding to the rate of the inter 2N×2N prediction mode in FIG. The distortion cost value cost_2 is weighted and summed to obtain the fifth estimate of the rate-distortion cost value of the left block 0 in FIG. 5; the upper right sub-coding block 1 in FIG. The distortion cost value cost_1 and the rate-distortion cost value cost_3 of the lower right sub-coding block 3 corresponding to the inter 2N×2N prediction mode are weighted and summed to obtain the sixth estimated value of the rate-distortion cost value of the right block 1 in FIG. 5 .

可选地,作为一个实施例,步骤240可包括:确定第一率失真代价值、第一估计值和第二估计值中的最小值;当最小值对应的帧间预测模式为帧间2N×2N预测模式时,将帧间2N×2N预测模式作为编码块的最优帧间预测模式;根据最优帧间预测模式,确定编码块的最优预测模式。Optionally, as an embodiment, step 240 may include: determining the minimum value among the first rate-distortion cost value, the first estimated value, and the second estimated value; when the inter-frame prediction mode corresponding to the minimum value is inter-frame 2N× In the 2N prediction mode, the inter-frame 2N×2N prediction mode is used as the optimal inter-frame prediction mode of the coding block; according to the optimal inter-frame prediction mode, the optimal prediction mode of the coding block is determined.

本发明实施例中,直接将最小值对应的帧间预测模式确定为最优帧间预测模式,进一步降低了图像的编码复杂度。In the embodiment of the present invention, the inter-frame prediction mode corresponding to the minimum value is directly determined as the optimal inter-frame prediction mode, which further reduces the coding complexity of the image.

可选地,作为一个实施例,步骤240可包括:确定第一率失真代价值、第一估计值和第二估计值中的最小值;当最小值对应的目标帧间预测模式为帧间2N×N预测模式或帧间N×2N预测模式时,使用目标帧间预测模式对编码块进行预测,并获得编码块对应于目标帧间预测模式的第二率失真代价值;将第一率失真代价值和第二率失真代价值中的较小值对应的帧间预测模式作为编码块的最优帧间预测模式;根据最优帧间预测模式,确定编码块的最优预测模式。Optionally, as an embodiment, step 240 may include: determining the minimum value among the first rate-distortion cost value, the first estimated value, and the second estimated value; when the target inter-frame prediction mode corresponding to the minimum value is inter-frame 2N In the ×N prediction mode or the inter-frame N×2N prediction mode, the target inter-frame prediction mode is used to predict the coding block, and the second rate-distortion cost value of the coding block corresponding to the target inter-frame prediction mode is obtained; The inter-frame prediction mode corresponding to the smaller of the cost value and the second rate-distortion cost value is used as the optimal inter-frame prediction mode of the coding block; the optimal inter-frame prediction mode of the coding block is determined according to the optimal inter-frame prediction mode.

当最小值对应的目标帧间预测模式并非帧间2N×2N预测模式时,本发明实施例并非将该目标帧间预测模式直接确定为编码块的最优帧间预测模式,而是需要使用该目标预测模式对该编码块进行预测,进一步验证编码块对应于该目标帧间预测模式的率失真代价值是否真的小于该编码块对应于帧间2N×2N预测模式的率失真代价值,一定程度上提高了确定最优帧间预测模式的准确性。When the target inter-frame prediction mode corresponding to the minimum value is not the inter-frame 2N×2N prediction mode, the embodiment of the present invention does not directly determine the target inter-frame prediction mode as the optimal inter-frame prediction mode of the coding block, but needs to use the target inter-frame prediction mode. The target prediction mode predicts the coding block, and further verifies whether the rate-distortion cost value of the coding block corresponding to the target inter-frame prediction mode is really less than the rate-distortion cost value of the coding block corresponding to the inter-frame 2N×2N prediction mode, which must be To a certain extent, the accuracy of determining the optimal inter-frame prediction mode is improved.

此外,上述根据编码块的最优帧间预测模式,确定编码块的最优预测模式的实现方式可以有多种,例如,可以直接将该编码块的最优帧间预测模式作为该编码块的最优预测模式;或者,使用该编码块的帧内预测模式进行预测,然后基于率失真算法从编码块的最优帧间预测模式和帧内预测模式中选取使得编码块的率失真代价值最小的预测模式,作为该编码块的最优预测模式。In addition, there can be various implementations for determining the optimal prediction mode of the coding block according to the optimal inter-frame prediction mode of the coding block. For example, the optimal inter-frame prediction mode of the coding block can be directly used as the Optimal prediction mode; or, use the intra-frame prediction mode of the coding block for prediction, and then select from the optimal inter-frame prediction mode and intra-frame prediction mode of the coding block based on the rate-distortion algorithm to minimize the rate-distortion cost of the coding block , as the optimal prediction mode for the coding block.

可选地,作为一个实施例,上述根据编码块的最优帧间预测模式,确定编码块的最优预测模式可包括:当编码块对应于最优帧间预测模式的率失真代价值小于或等于预设阈值时,将最优帧间预测模式作为最优预测模式;或者,当编码块对应于最优帧间预测模式的率失真代价值大于预设阈值时,使用帧内预测模式对编码块进行预测,并获取编码块对应于帧内预测模式的第三率失真代价值,将编码块对应于最优帧间预测模式的率失真代价值和第三率失真代价值中的较小值对应的预测模式作为编码块的最优预测模式。Optionally, as an embodiment, the above-mentioned determining the optimal prediction mode of the coding block according to the optimal inter-frame prediction mode of the coding block may include: when the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is less than or When it is equal to the preset threshold, the optimal inter prediction mode is used as the optimal prediction mode; or, when the rate-distortion cost value of the coding block corresponding to the optimal inter prediction mode is greater than the preset threshold, the intra prediction mode is used for encoding block prediction, and obtain the third rate-distortion cost value of the coding block corresponding to the intra-frame prediction mode, and set the coding block corresponding to the rate-distortion cost value of the optimal inter-frame prediction mode and the smaller value of the third rate-distortion cost value The corresponding prediction mode is used as the optimal prediction mode for the coded block.

本发明实施例中,通过直接将编码块对应于最优帧间预测模式的率失真代价值与预设的阈值进行比较,如果小于该阈值,则无需进行帧内预测,直接将该编码块的最优帧间预测模式确定为该编码块的最优预测模式,进一步降低了图像的编码复杂度。可以根据经验或者测试确定该预设阈值的取值,当编码块对应于最优帧间预测模式的率失真代价值(以下成当前率失真代价值)小于该预设阈值时,就可以认为该最优帧间预测模式可以满足编码要求,虽然继续确定编码块对应于其他预测模式下的率失真代价值可能会得到比该当前率失真代价值更小的取值,但也不会对编码性能有质的提升。In this embodiment of the present invention, the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is directly compared with a preset threshold. The optimal inter-frame prediction mode is determined as the optimal prediction mode of the coding block, which further reduces the coding complexity of the image. The value of the preset threshold can be determined according to experience or testing. When the rate-distortion cost value (hereinafter referred to as the current rate-distortion cost value) of the coding block corresponding to the optimal inter-frame prediction mode is less than the preset threshold, it can be considered that the The optimal inter-frame prediction mode can meet the coding requirements. Although continuing to determine the rate-distortion cost value of the coding block corresponding to other prediction modes may obtain a value smaller than the current rate-distortion cost value, it will not affect the coding performance. A qualitative improvement.

可选地,作为一个实施例,上述根据编码块的最优帧间预测模式,确定编码块的最优预测模式可包括:当M个子编码块的最优预测模式均为帧间预测模式时,将最优帧间预测模式确定为编码块的最优预测模式;或者,当M个子编码块中存在最优预测模式为帧内预测模式的子编码块时,使用帧内预测模式对编码块进行预测,并获取编码块对应于帧内预测模式的第三率失真代价值,将编码块对应于最优帧间预测模式的率失真代价值和第三率失真代价值中的较小值对应的预测模式作为编码块的最优预测模式。Optionally, as an embodiment, the above-mentioned determining the optimal prediction mode of the coding block according to the optimal inter-frame prediction mode of the coding block may include: when the optimal prediction modes of the M sub-coding blocks are all inter-frame prediction modes, The optimal inter-frame prediction mode is determined as the optimal prediction mode of the coding block; or, when there are sub-coding blocks whose optimal prediction mode is the intra-frame prediction mode in the M sub-coding blocks, the intra-frame prediction mode is used to perform the coding on the coding block. Predict, and obtain the third rate-distortion cost value of the coding block corresponding to the intra-frame prediction mode, and set the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode and the third rate-distortion cost value corresponding to the smaller value The prediction mode serves as the optimal prediction mode for the coded block.

本发明实施例中,当M个子编码块的最优预测模式均为帧间预测模式时,可以推定该编码块的最优预测模式也为帧间预测模式,也就无需进一步比较编码块在帧间预测模式和帧内预测模式下的率失真代价值,从而进一步降低了图像编码的复杂度。In this embodiment of the present invention, when the optimal prediction modes of the M sub-coding blocks are all inter-frame prediction modes, it can be inferred that the optimal prediction mode of the coding block is also the inter-frame prediction mode, and there is no need to further compare the coding blocks in the frame The rate-distortion cost value in the inter prediction mode and the intra prediction mode is further reduced, thereby further reducing the complexity of image coding.

下面以HEVC中的编码流程和框架为例,更加详细地描述本发明实施例。应注意,图6至图10的例子仅仅是为了帮助本领域技术人员理解本发明实施例,而非要将本发明实施例限于所例示的具体数值或具体场景。本领域技术人员根据所给出的图6至图10的例子,显然可以进行各种等价的修改或变化,这样的修改或变化也落入本发明实施例的范围内。The embodiments of the present invention are described in more detail below by taking an encoding process and framework in HEVC as an example. It should be noted that the examples in FIG. 6 to FIG. 10 are only for helping those skilled in the art to understand the embodiments of the present invention, and are not intended to limit the embodiments of the present invention to specific numerical values or specific scenarios exemplified. According to the examples shown in FIGS. 6 to 10 , those skilled in the art can obviously make various equivalent modifications or changes, and such modifications or changes also fall within the scope of the embodiments of the present invention.

首先将整个LCU编码流程分为自上向下(从第0层至第3层)粗略计算和自下向上(从第3层至第0层)精细计算2部分。First, the entire LCU coding process is divided into two parts: top-down (from layer 0 to layer 3) rough calculation and bottom-up (from layer 3 to layer 0) fine calculation.

自上向下时,可以计算帧内或帧间的一部分预测模式,在计算自下向上时,再计算其余预测模式。粗略计算以只计算帧间2Nx2N预测模式为例,具体流程参见图6。When calculating from top to bottom, a part of intra-frame or inter-frame prediction modes can be calculated, and when calculating from bottom to top, the remaining prediction modes can be calculated. The rough calculation takes the calculation of only the inter-frame 2Nx2N prediction mode as an example, and the specific flow is shown in FIG. 6 .

粗略计算时,第0层可以只计算1个64x64块的帧间2Nx2N预测模式;第1层时,可以只计算4个32x32块的帧间2Nx2N预测模式;第2层时,可以只计算16个16x16块的帧间2Nx2N预测模式;第3层时,可以只计算64个8x8块的帧间NxN预测模式。在自下向上精细计算时,可以先计算完帧间的剩余预测模式(包括帧间2N×N预测模式和帧间N×2N预测模式),然后再计算帧内预测模式。In the rough calculation, the 0th layer can only calculate the inter-frame 2Nx2N prediction mode of 1 64x64 block; in the first layer, only 4 inter-frame 2Nx2N prediction modes of 32x32 blocks can be calculated; in the second layer, only 16 can be calculated. Inter-frame 2Nx2N prediction mode of 16x16 blocks; in the third layer, only 64 inter-frame NxN prediction modes of 8x8 blocks can be calculated. During the bottom-up fine calculation, the remaining prediction modes (including the inter-frame 2N×N prediction mode and the inter-frame N×2N prediction mode) may be calculated first, and then the intra-frame prediction mode may be calculated.

在图6的大体架构的基础上,可以对整个编码流程进行进一步完善,例如,在精细计算时增加做帧内或帧间的判决条件,然后根据粗略计算时已经获得的信息和/或当前层编码块的下层子块预测编码得到的信息和增加的判决条件,有选择性做当前层编码块的帧内或帧间预测,下面结合图7具体说明。On the basis of the general architecture of Figure 6, the entire encoding process can be further improved, for example, adding intra-frame or inter-frame decision conditions during fine calculation, and then according to the information already obtained during rough calculation and/or the current layer The information obtained by predictive coding of the lower layer sub-blocks of the coding block and the added decision conditions are selectively used for intra-frame or inter-frame prediction of the coding block of the current layer, which is described in detail below with reference to FIG. 7 .

1、精细计算时判断是否做帧间的条件及流程1. Condition and process for judging whether to do inter-frame during fine calculation

以下层的子编码块的对应于帧间2N×2N预测模式的率失真代价值来预估当前层编码块的对应于帧间2N×N预测模式和帧间N×2N预测模式的率失真代价值为例,说明如下:The rate-distortion cost value corresponding to the inter 2N×2N prediction mode of the sub-coding blocks of the lower layer is estimated to be the rate-distortion cost value corresponding to the inter 2N×N prediction mode and the inter N×2N prediction mode of the coding block of the current layer. As an example of value, the description is as follows:

Step1:记录粗略计算时每层编码块使用帧间2Nx2N预测模式进行预测后得到的率失真代价值cost_2N×2N。Step 1: Record the rate-distortion cost value cost_2N×2N obtained by using the inter-frame 2Nx2N prediction mode for each coding block during rough calculation.

以一个编码块为例进行举例说明,假设该编码块支持merge和amvp两种帧间预测模式,可以获取该编码块(作为一个整体,不进行分割)在merge预测模式下的satd值和bit值,然后可以利用率失真代价公式:cost=satd+λ*bit计算编码块在merge预测模式下的率失真代价值,并获取该编码块在amvp预测模式下的satd值和bit值,然后可以利用率失真代价公式:cost=satd+λ*bit计算编码块在amvp预测模式下的率失真代价值。将得到的上述率失真代价值作为该编码块对应于帧间2N×2N预测模式的率失真代价值。Take a coding block as an example for illustration. Assuming that the coding block supports two inter-frame prediction modes, merge and amvp, you can obtain the satd value and bit value of the coding block (as a whole, not divided) in the merge prediction mode. , and then you can use the distortion cost formula: cost=satd+λ*bit to calculate the rate-distortion cost value of the coding block in the merge prediction mode, and obtain the satd value and bit value of the coding block in the amvp prediction mode, and then use the Rate-distortion cost formula: cost=satd+λ*bit Calculate the rate-distortion cost of the coding block in the amvp prediction mode. The obtained rate-distortion cost value is taken as the rate-distortion cost value of the coding block corresponding to the inter 2N×2N prediction mode.

Step2:基于粗略计算时记录的信息,确定当前层的编码块对应于帧间2N×N预测模式的率失真代价值的估计值,以及当前层的编码块对应于帧间N×2N预测模式的率失真代价值的估计值。Step2: Based on the information recorded during the rough calculation, determine the estimated value of the rate-distortion cost value of the coding block of the current layer corresponding to the inter-frame 2N×N prediction mode, and the coding block of the current layer corresponding to the inter-frame N×2N prediction mode. Estimated rate-distortion cost.

具体地,以确定当前层的编码块对应于帧间2N×N预测模式的率失真代价值的估计值为例进行举例说明。首先,记录的信息可包括该编码块的4个子编码块对应于帧间2N×2N预测模式的率失真代价值,例如,每个子编码块在merge预测模式下的率失真代价值,以及每个子编码块在amvp预测模式下的率失真代价值。然后可以基于率失真代价公式,按照图8中(a)所示的方式进行组合,求得最优的率失真代价值,作为该编码块对应于帧间2N×N预测模式的率失真代价值的估计值;同理,按照图8中(b)的方式进行组合,求得最优的率失真代价值,作为该编码块对应于帧间N×2N预测模式的率失真代价值的估计值。Specifically, determining the estimated value of the rate-distortion cost value of the coding block of the current layer corresponding to the inter-frame 2N×N prediction mode is taken as an example for illustration. First, the recorded information may include the rate-distortion cost value of the 4 sub-coding blocks of the coding block corresponding to the inter 2N×2N prediction mode, for example, the rate-distortion cost value of each sub-coding block in the merge prediction mode, and the rate-distortion cost value of each sub-coding block in the merge prediction mode. Rate-distortion cost of the coded block in amvp prediction mode. Then, based on the rate-distortion cost formula, it can be combined in the manner shown in (a) in Figure 8 to obtain the optimal rate-distortion cost value as the rate-distortion cost value of the coding block corresponding to the inter-frame 2N×N prediction mode Similarly, according to the method of (b) in Figure 8, the optimal rate-distortion cost value is obtained as the estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame N×2N prediction mode .

Step3:从当前层的编码块对应于帧间2N×2N预测模式的率失真代价值、以及Step2中确定出的估计值中选取cost的最小值,如果最小值为帧间2N×N预测模式的率失真代价值的估计值,则对该编码块进行帧间2NxN预测;如果最小值为帧间N×2N率失真代价值的估计值,则对该编码块进行帧间Nx2N预测;如果最小值为帧间2N×2N预测模式的率失真代价值,则不再继续执行帧间计算。Step3: Select the minimum value of cost from the rate-distortion cost value of the coding block of the current layer corresponding to the inter-frame 2N×2N prediction mode and the estimated value determined in Step2, if the minimum value is the inter-frame 2N×N prediction mode If the estimated value of the rate-distortion cost value is the estimated value of the rate-distortion cost value, the inter-frame 2NxN prediction is performed on the coding block; if the minimum value is the estimated value of the inter-frame N×2N rate-distortion cost value, the inter-frame Nx2N prediction is performed on the coding block; is the rate-distortion cost value of the inter-frame 2N×2N prediction mode, then the inter-frame calculation is no longer performed.

2、精细计算时判断是否做帧内的条件及流程2. Determine whether to do the conditions and processes in the frame during fine calculation

针对8×8块,其判断是否做帧内的条件及流程如图9所示。For an 8×8 block, the conditions and process for judging whether to perform an intra-frame are shown in FIG. 9 .

具体而言,帧间择优后当前层cost与预设阈值比较,如果cost小于或等于阈值thr1,就不做帧内计算,否则做帧内2Nx2N。计算并择优后,如果编码块的最优预测模式为帧内预测模式,则再做帧内N×N预测,否则不再做帧内N×N预测。本实施例中阈值thr1可以设定为1000。当然,还可以加入其它阈值条件来作为是否做帧内计算的判决条件,例如当帧间cost小于thr1,和/或运动矢量残差(Motion Vector Difference,MVD)小于thr2(比如设定为80)时,就不做帧内计算,否则继续执行帧内计算。Specifically, after inter-frame selection, the current layer cost is compared with the preset threshold. If the cost is less than or equal to the threshold thr1, no intra-frame calculation is performed, otherwise, intra-frame 2Nx2N is performed. After calculation and selection, if the optimal prediction mode of the coding block is the intra-frame prediction mode, the intra-frame N×N prediction is performed again, otherwise, the intra-frame N×N prediction is not performed. In this embodiment, the threshold thr1 may be set to 1000. Of course, other threshold conditions can also be added as the decision conditions for whether to perform intra-frame calculation, for example, when the inter-frame cost is less than thr1, and/or the motion vector residual (Motion Vector Difference, MVD) is less than thr2 (for example, set to 80) When , do not perform intra-frame calculation, otherwise continue to perform intra-frame calculation.

针对非8×8块,可以采用图10所示的流程图判断是否做帧内计算。For non-8×8 blocks, the flowchart shown in FIG. 10 may be used to determine whether to perform intra-frame calculation.

当前层的编码块帧间择优后,统计该编码块的4个子编码块块的预测模式。如果4个子编码块的预测模式均为帧间预测模式,则不再做该编码块的帧内2Nx2N预测模式,否则,可以继续执行该编码块的帧内预测模式。当然,在准备执行编码块的帧内预测模式时,也可以通过一些方式降低帧内计算的运算量,例如,可以首先判断4个子编码块块中帧内方向有没有0或1,如果有0或1,就做该编码块的帧内2Nx2N预测,否则,可以计算相邻帧内子块的方向差值。如果相邻小于阈值thr,则做帧内2Nx2N预测,否则可以不做帧内2Nx2N预测,本发明实施例对此不作具体限定。After the coding block of the current layer is selected among the frames, the prediction modes of the four sub-coding blocks of the coding block are counted. If the prediction modes of the four sub-coding blocks are all inter-frame prediction modes, the intra-frame 2Nx2N prediction mode of the coding block is not performed, otherwise, the intra-frame prediction mode of the coding block may continue to be executed. Of course, when preparing to execute the intra-frame prediction mode of the coding block, the computational complexity of the intra-frame calculation can also be reduced in some ways. For example, it is possible to first determine whether there are 0 or 1 in the intra-frame direction in the four sub-coding blocks, and if there is a 0 or 1, do the intra-frame 2Nx2N prediction of the coding block, otherwise, the direction difference of the adjacent intra-frame sub-blocks can be calculated. If the neighbor is less than the threshold thr, intra-frame 2Nx2N prediction is performed, otherwise, intra-frame 2Nx2N prediction may not be performed, which is not specifically limited in this embodiment of the present invention.

上文中结合图1至图10,详细描述了根据本发明实施例的图像编码方法,下面将结合图11至图12,详细描述根据本发明实施例的图像编码器。应理解,图11和图12中的图像编码器能够实现图1至图10中的图像编码方法的各个步骤,为了简洁,适当省略重复的描述。The image encoding method according to the embodiment of the present invention is described in detail above with reference to FIG. 1 to FIG. 10 , and the image encoder according to the embodiment of the present invention will be described in detail below with reference to FIG. 11 to FIG. 12 . It should be understood that the image encoders in FIG. 11 and FIG. 12 can implement various steps of the image encoding methods in FIGS. 1 to 10 , and repeated descriptions are appropriately omitted for brevity.

图11是本发明实施例的图像编码器的示意性框图。图11的图像编码器1100包括:FIG. 11 is a schematic block diagram of an image encoder according to an embodiment of the present invention. The image encoder 1100 of FIG. 11 includes:

划分模块1110,用于将待编码的编码块划分为M个子编码块,所述编码块为所述图像的图像块,所述M为大于等于2的正整数;a dividing module 1110, configured to divide the coding block to be coded into M sub-coding blocks, where the coding block is an image block of the image, and M is a positive integer greater than or equal to 2;

获取模块1120,用于使用帧间2N×2N预测模式对所述编码块进行预测,并获取所述编码块对应于帧间2N×2N预测模式的第一率失真代价值,使用帧间2N×2N预测模式对所述划分模块1110划分得到的所述M个子编码块进行预测,并获取所述M个子编码块中的每个子编码块各自对应于帧间2N×2N预测模式的率失真代价值;The obtaining module 1120 is configured to predict the coding block by using the inter-frame 2N×2N prediction mode, and obtain the first rate-distortion cost value of the coding block corresponding to the inter-frame 2N×2N prediction mode, using the inter-frame 2N×2N prediction mode The 2N prediction mode predicts the M sub-coding blocks divided by the dividing module 1110, and obtains the rate-distortion cost value of each sub-coding block in the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode. ;

第一确定模块1130,用于根据所述获取模块1120获取到的所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间2N×N预测模式的率失真代价值的第一估计值,以及根据所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间N×2N预测模式的率失真代价值的第二估计值;The first determining module 1130 is configured to determine, according to the rate-distortion cost value of the M sub-coding blocks obtained by the obtaining module 1120 corresponding to the inter-frame 2N×2N prediction mode, that the coding block corresponds to the inter-frame 2N×N a first estimate of the rate-distortion cost value of the prediction mode, and determining that the coding block corresponds to the inter-frame N×2N prediction mode according to the rate-distortion cost value of the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode A second estimate of the rate-distortion cost of ;

第二确定模块1140,用于根据所述获取模块1120获取到的所述第一率失真代价值、所述第一确定模块1130确定的所述第一估计值和所述第二估计值,确定所述编码块的最优预测模式;The second determining module 1140 is configured to determine according to the first rate-distortion cost value acquired by the acquiring module 1120, the first estimated value and the second estimated value determined by the first determining module 1130 the optimal prediction mode for the coding block;

编码模块1150,用于根据所述第二确定模块1140确定的所述编码块的最优预测模式,对所述编码块进行预测编码。The coding module 1150 is configured to perform predictive coding on the coding block according to the optimal prediction mode of the coding block determined by the second determining module 1140 .

本发明实施例将编码块划分成M个子编码块,分别获取该编码块和该M个子编码块对应于帧间2N×2N预测模式的率失真代价值,根据该M个子编码块的率失真代价值确定该编码块对应于帧间2N×N预测模式的率失真代价值的估计值,以及该编码块对应于帧间N×2N预测模式的率失真代价值的估计值,根据获取到的该编码块的率失真代价值以及确定出的该编码块的率失真代价值的估计值,确定该编码块的最优预测模式,无需像现有技术那样使用所有预测模式对该编码块进行预测以选出该编码块的最优预测模式,从而降低了图像的编码复杂度。The embodiment of the present invention divides the coding block into M sub-coding blocks, obtains the rate-distortion cost values of the coding block and the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode, and obtains the rate-distortion cost values of the M sub-coding blocks according to the rate-distortion generation of the M sub-coding blocks. The value determines the estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame 2N×N prediction mode, and the estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame N×2N prediction mode. The rate-distortion cost value of the coding block and the determined estimated value of the rate-distortion cost value of the coding block, determine the optimal prediction mode of the coding block, and it is not necessary to use all prediction modes to predict the coding block as in the prior art. The optimal prediction mode of the coding block is selected, thereby reducing the coding complexity of the image.

可选地,作为一个实施例,所述M为4,所述M个子编码块包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,所述第一确定模块1130具体用于根据所述左上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右上子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左上子编码块和所述右上子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第三估计值;根据所述左下子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左下子编码块和所述右下子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第四估计值;根据所述第三估计值和所述第四估计值,计算所述第一估计值。Optionally, as an embodiment, the M is 4, and the M sub-coding blocks include an upper-left sub-coding block, an upper-right sub-coding block, a lower-left sub-coding block, and a lower-right sub-coding block. The first determining module 1130 specifically for determining the upper left sub-coding block according to the rate-distortion cost value of the upper left sub-coding block corresponding to the inter 2N×2N prediction mode and the rate-distortion cost value of the upper right sub-coding block corresponding to the inter 2N×2N prediction mode The image block composed of the coding block and the upper right sub-coding block corresponds to the third estimated value of the rate-distortion cost value of the inter-frame 2N×N prediction mode; The rate-distortion cost value and the lower-right sub-coding block correspond to the rate-distortion cost value of the inter-frame 2N×2N prediction mode, and it is determined that the image block composed of the lower-left sub-coding block and the lower-right sub-coding block corresponds to the inter-frame 2N×2N A fourth estimate of the rate-distortion cost value of the N prediction mode; the first estimate is calculated based on the third estimate and the fourth estimate.

可选地,作为一个实施例,所述M为4,所述M个子编码块包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,所述第一确定模块1130具体用于根据所述左上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述左下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左上子编码块和所述左下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第五估计值;根据所述右上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述右上子编码块和所述右下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第六估计值;根据所述第五估计值和所述第六估计值,计算所述编码块的所述第二估计值。Optionally, as an embodiment, the M is 4, and the M sub-coding blocks include an upper-left sub-coding block, an upper-right sub-coding block, a lower-left sub-coding block, and a lower-right sub-coding block. The first determining module 1130 specifically for determining the upper left sub-coding block according to the rate-distortion cost value of the upper left sub-coding block corresponding to the inter 2N×2N prediction mode and the rate-distortion cost value of the lower left sub-coding block corresponding to the inter 2N×2N prediction mode The image block composed of the coding block and the lower left sub-coding block corresponds to the fifth estimated value of the rate-distortion cost value of the inter-frame N×2N prediction mode; according to the upper right sub-coding block corresponding to the inter-frame 2N×2N prediction mode The rate-distortion cost value and the lower-right sub-coding block correspond to the rate-distortion cost value of the inter-frame 2N×2N prediction mode, and it is determined that the image block composed of the upper-right sub-coding block and the lower-right sub-coding block corresponds to the inter-frame N× a sixth estimate of a rate-distortion cost value for a 2N prediction mode; calculating the second estimate of the coding block based on the fifth estimate and the sixth estimate.

可选地,作为一个实施例,所述第二确定模块1140具体用于确定所述第一率失真代价值、所述第一估计值和所述第二估计值中的最小值;当所述最小值对应的帧间预测模式为帧间2N×2N预测模式时,将帧间2N×2N预测模式作为所述编码块的最优帧间预测模式;根据所述最优帧间预测模式,确定所述编码块的最优预测模式。Optionally, as an embodiment, the second determining module 1140 is specifically configured to determine the minimum value among the first rate-distortion cost value, the first estimated value, and the second estimated value; when the When the inter-frame prediction mode corresponding to the minimum value is the inter-frame 2N×2N prediction mode, the inter-frame 2N×2N prediction mode is used as the optimal inter-frame prediction mode of the coding block; according to the optimal inter-frame prediction mode, determine the optimal prediction mode for the coding block.

可选地,作为一个实施例,所述第二确定模块1140具体用于确定所述第一率失真代价值、所述第一估计值和所述第二估计值中的最小值;当所述最小值对应的目标帧间预测模式为帧间2N×N预测模式或帧间N×2N预测模式时,使用所述目标帧间预测模式对所述编码块进行预测,并获得所述编码块对应于所述目标帧间预测模式的第二率失真代价值;将所述第一率失真代价值和所述第二率失真代价值中的较小值对应的帧间预测模式作为所述编码块的最优帧间预测模式;根据所述最优帧间预测模式,确定所述编码块的最优预测模式。Optionally, as an embodiment, the second determining module 1140 is specifically configured to determine the minimum value among the first rate-distortion cost value, the first estimated value, and the second estimated value; when the When the target inter-frame prediction mode corresponding to the minimum value is the inter-frame 2N×N prediction mode or the inter-frame N×2N prediction mode, the target inter-frame prediction mode is used to predict the coding block, and the corresponding coding block is obtained. the second rate-distortion cost value of the target inter-frame prediction mode; the inter-frame prediction mode corresponding to the smaller of the first rate-distortion cost value and the second rate-distortion cost value is used as the coding block the optimal inter-frame prediction mode; according to the optimal inter-frame prediction mode, determine the optimal prediction mode of the coding block.

可选地,作为一个实施例,所述第二确定模块1140具体用于当所述编码块对应于所述最优帧间预测模式的率失真代价值小于或等于预设阈值时,将所述最优帧间预测模式作为所述最优预测模式;或者,当所述编码块对应于所述最优帧间预测模式的率失真代价值大于所述预设阈值时,使用帧内预测模式对所述编码块进行预测,并获取所述编码块对应于帧内预测模式的第三率失真代价值,将所述编码块对应于所述最优帧间预测模式的率失真代价值和所述第三率失真代价值中的较小值对应的预测模式作为所述编码块的最优预测模式。Optionally, as an embodiment, the second determining module 1140 is specifically configured to, when the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is less than or equal to a preset threshold, determine the The optimal inter-frame prediction mode is used as the optimal prediction mode; or, when the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is greater than the preset threshold, use the intra-frame prediction mode to performing prediction on the coding block, obtaining a third rate-distortion cost value of the coding block corresponding to the intra-frame prediction mode, and comparing the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode and the The prediction mode corresponding to the smaller value of the third rate-distortion cost value is used as the optimal prediction mode of the coding block.

可选地,作为一个实施例,所述第二确定模块1140具体用于当所述M个子编码块的最优预测模式均为帧间预测模式时,将所述最优帧间预测模式确定为所述编码块的最优预测模式;或者,当所述M个子编码块中存在最优预测模式为帧内预测模式的子编码块时,使用帧内预测模式对所述编码块进行预测,并获取所述编码块对应于帧内预测模式的第三率失真代价值,将所述编码块对应于所述最优帧间预测模式的率失真代价值和所述第三率失真代价值中的较小值对应的预测模式作为所述编码块的最优预测模式。Optionally, as an embodiment, the second determining module 1140 is specifically configured to, when the optimal prediction modes of the M sub-coding blocks are all inter prediction modes, determine the optimal inter prediction mode as the optimal prediction mode of the coding block; or, when there is a sub-coding block whose optimal prediction mode is the intra-frame prediction mode in the M sub-coding blocks, use the intra-frame prediction mode to predict the coding block, and Obtain the third rate-distortion cost value of the coding block corresponding to the intra-frame prediction mode, and set the coding block corresponding to the rate-distortion cost value of the optimal inter-frame prediction mode and the third rate-distortion cost value. The prediction mode corresponding to the smaller value is used as the optimal prediction mode of the coding block.

图12是本发明实施例的图像编码器的示意性框图。图12的图像编码器1300包括:FIG. 12 is a schematic block diagram of an image encoder according to an embodiment of the present invention. The image encoder 1300 of FIG. 12 includes:

存储器1210,用于存储程序;a memory 1210 for storing programs;

处理器1220,用于执行程序,当程序被执行时,所述处理器1220具体用于将待编码的编码块划分为M个子编码块,所述编码块为所述图像的图像块,所述M为大于等于2的正整数;使用帧间2N×2N预测模式对所述编码块进行预测,并获取所述编码块对应于帧间2N×2N预测模式的第一率失真代价值,使用帧间2N×2N预测模式对所述M个子编码块进行预测,并获取所述M个子编码块中的每个子编码块各自对应于帧间2N×2N预测模式的率失真代价值;根据所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间2N×N预测模式的率失真代价值的第一估计值,以及根据所述M个子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述编码块对应于帧间N×2N预测模式的率失真代价值的第二估计值;根据获取到的所述第一率失真代价值、所述第一估计值和所述第二估计值,确定所述编码块的最优预测模式;根据所述编码块的最优预测模式,对所述编码块进行预测编码。The processor 1220 is configured to execute the program. When the program is executed, the processor 1220 is specifically configured to divide the encoding block to be encoded into M sub-encoding blocks, where the encoding block is an image block of the image, and the encoding block is an image block of the image. M is a positive integer greater than or equal to 2; use the inter-frame 2N×2N prediction mode to predict the coding block, and obtain the first rate-distortion cost value of the coding block corresponding to the inter-frame 2N×2N prediction mode, using the frame The inter 2N×2N prediction mode predicts the M sub-coding blocks, and obtains the rate-distortion cost value of each sub-coding block in the M sub-coding blocks corresponding to the inter 2N×2N prediction mode; according to the M sub-coding blocks sub-coding blocks corresponding to rate-distortion cost values of the inter 2N×2N prediction mode, determining a first estimate of the rate-distortion cost values of the coding blocks corresponding to the inter 2N×N prediction mode, and determining according to the M sub-coding The block corresponds to the rate-distortion cost value of the inter-frame 2N×2N prediction mode, and the second estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame N×2N prediction mode is determined; according to the obtained first rate The distortion cost value, the first estimated value and the second estimated value determine the optimal prediction mode of the coding block; and perform predictive coding on the coding block according to the optimal prediction mode of the coding block.

本发明实施例将编码块划分成M个子编码块,分别获取该编码块和该M个子编码块对应于帧间2N×2N预测模式的率失真代价值,根据该M个子编码块的率失真代价值确定该编码块对应于帧间2N×N预测模式的率失真代价值的估计值,以及该编码块对应于帧间N×2N预测模式的率失真代价值的估计值,根据获取到的该编码块的率失真代价值以及确定出的该编码块的率失真代价值的估计值,确定该编码块的最优预测模式,无需像现有技术那样使用所有预测模式对该编码块进行预测以选出该编码块的最优预测模式,从而降低了图像的编码复杂度。The embodiment of the present invention divides the coding block into M sub-coding blocks, obtains the rate-distortion cost values of the coding block and the M sub-coding blocks corresponding to the inter-frame 2N×2N prediction mode, and obtains the rate-distortion cost values of the M sub-coding blocks according to the rate-distortion generation of the M sub-coding blocks. The value determines the estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame 2N×N prediction mode, and the estimated value of the rate-distortion cost value of the coding block corresponding to the inter-frame N×2N prediction mode. The rate-distortion cost value of the coding block and the determined estimated value of the rate-distortion cost value of the coding block, determine the optimal prediction mode of the coding block, and it is not necessary to use all prediction modes to predict the coding block as in the prior art. The optimal prediction mode of the coding block is selected, thereby reducing the coding complexity of the image.

可选地,作为一个实施例,所述M为4,所述M个子编码块包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,所述处理器1220具体用于根据所述左上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右上子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左上子编码块和所述右上子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第三估计值;根据所述左下子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左下子编码块和所述右下子编码块组成的图像块对应于帧间2N×N预测模式的率失真代价值的第四估计值;根据所述第三估计值和所述第四估计值,计算所述第一估计值。Optionally, as an embodiment, the M is 4, and the M sub-coding blocks include an upper-left sub-coding block, an upper-right sub-coding block, a lower-left sub-coding block, and a lower-right sub-coding block. The processor 1220 is specifically configured to The upper left sub-coding block is determined according to the rate-distortion cost value of the upper-left sub-coding block corresponding to the inter 2N×2N prediction mode and the rate-distortion cost value of the upper-right sub-coding block corresponding to the inter 2N×2N prediction mode The image block formed with the upper right sub-coding block corresponds to the third estimated value of the rate-distortion cost value of the inter 2N×N prediction mode; according to the lower left sub-coding block corresponding to the rate-distortion of the inter 2N×2N prediction mode The cost value and the lower right sub-coding block correspond to the rate-distortion cost value of the inter-frame 2N×2N prediction mode, and it is determined that the image block composed of the lower-left sub-coding block and the lower-right sub-coding block corresponds to the inter-frame 2N×N prediction a fourth estimate of the rate-distortion cost value of the mode; the first estimate is calculated based on the third estimate and the fourth estimate.

可选地,作为一个实施例,所述M为4,所述M个子编码块包括左上子编码块、右上子编码块、左下子编码块、右下子编码块,所述处理器1220具体用于根据所述左上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述左下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述左上子编码块和所述左下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第五估计值;根据所述右上子编码块对应于帧间2N×2N预测模式的率失真代价值和所述右下子编码块对应于帧间2N×2N预测模式的率失真代价值,确定所述右上子编码块和所述右下子编码块组成的图像块对应于帧间N×2N预测模式的率失真代价值的第六估计值;根据所述第五估计值和所述第六估计值,计算所述编码块的所述第二估计值。Optionally, as an embodiment, the M is 4, and the M sub-coding blocks include an upper-left sub-coding block, an upper-right sub-coding block, a lower-left sub-coding block, and a lower-right sub-coding block. The processor 1220 is specifically configured to The upper left sub-coding block is determined according to the rate-distortion cost value of the upper left sub-coding block corresponding to the inter 2N×2N prediction mode and the rate-distortion cost value of the lower left sub-coding block corresponding to the inter 2N×2N prediction mode The image block formed with the lower left sub-coding block corresponds to the fifth estimate of the rate-distortion cost value of the inter-frame N×2N prediction mode; The cost value and the lower right sub-coding block correspond to the rate-distortion cost value of the inter-frame 2N×2N prediction mode, and it is determined that the image block composed of the upper-right sub-coding block and the lower-right sub-coding block corresponds to the inter-frame N×2N prediction a sixth estimate of the rate-distortion cost value of the mode; and calculating the second estimate of the coded block based on the fifth estimate and the sixth estimate.

可选地,作为一个实施例,所述处理器1220具体用于确定所述第一率失真代价值、所述第一估计值和所述第二估计值中的最小值;当所述最小值对应的帧间预测模式为帧间2N×2N预测模式时,将帧间2N×2N预测模式作为所述编码块的最优帧间预测模式;根据所述最优帧间预测模式,确定所述编码块的最优预测模式。Optionally, as an embodiment, the processor 1220 is specifically configured to determine the minimum value among the first rate-distortion cost value, the first estimated value, and the second estimated value; when the minimum value is When the corresponding inter-frame prediction mode is the inter-frame 2N×2N prediction mode, the inter-frame 2N×2N prediction mode is used as the optimal inter-frame prediction mode of the coding block; according to the optimal inter-frame prediction mode, determine the The optimal prediction mode for the coded block.

可选地,作为一个实施例,所述处理器1220具体用于确定所述第一率失真代价值、所述第一估计值和所述第二估计值中的最小值;当所述最小值对应的目标帧间预测模式为帧间2N×N预测模式或帧间N×2N预测模式时,使用所述目标帧间预测模式对所述编码块进行预测,并获得所述编码块对应于所述目标帧间预测模式的第二率失真代价值;将所述第一率失真代价值和所述第二率失真代价值中的较小值对应的帧间预测模式作为所述编码块的最优帧间预测模式;根据所述最优帧间预测模式,确定所述编码块的最优预测模式。Optionally, as an embodiment, the processor 1220 is specifically configured to determine the minimum value among the first rate-distortion cost value, the first estimated value, and the second estimated value; when the minimum value is When the corresponding target inter-frame prediction mode is the inter-frame 2N×N prediction mode or the inter-frame N×2N prediction mode, use the target inter-frame prediction mode to predict the coding block, and obtain the coding block corresponding to the the second rate-distortion cost value of the target inter-frame prediction mode; the inter-frame prediction mode corresponding to the smaller value of the first rate-distortion cost value and the second rate-distortion cost value is taken as the maximum value of the coding block. an optimal inter-frame prediction mode; according to the optimal inter-frame prediction mode, an optimal prediction mode for the coding block is determined.

可选地,作为一个实施例,所述处理器1220具体用于当所述编码块对应于所述最优帧间预测模式的率失真代价值小于或等于预设阈值时,将所述最优帧间预测模式作为所述最优预测模式;或者,当所述编码块对应于所述最优帧间预测模式的率失真代价值大于所述预设阈值时,使用帧内预测模式对所述编码块进行预测,并获取所述编码块对应于帧内预测模式的第三率失真代价值,将所述编码块对应于所述最优帧间预测模式的率失真代价值和所述第三率失真代价值中的较小值对应的预测模式作为所述编码块的最优预测模式。Optionally, as an embodiment, the processor 1220 is specifically configured to, when the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is less than or equal to a preset threshold The inter-frame prediction mode is used as the optimal prediction mode; or, when the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is greater than the preset threshold, use the intra-frame prediction mode to The coding block is predicted, and the third rate-distortion cost value of the coding block corresponding to the intra-frame prediction mode is obtained, and the rate-distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode and the third rate-distortion cost value corresponding to the optimal inter-frame prediction mode are obtained. The prediction mode corresponding to the smaller value of the rate-distortion cost value is used as the optimal prediction mode for the coding block.

可选地,作为一个实施例,所述处理器1220具体用于当所述M个子编码块的最优预测模式均为帧间预测模式时,将所述最优帧间预测模式确定为所述编码块的最优预测模式;或者,当所述M个子编码块中存在最优预测模式为帧内预测模式的子编码块时,使用帧内预测模式对所述编码块进行预测,并获取所述编码块对应于帧内预测模式的第三率失真代价值,将所述编码块对应于所述最优帧间预测模式的率失真代价值和所述第三率失真代价值中的较小值对应的预测模式作为所述编码块的最优预测模式。Optionally, as an embodiment, the processor 1220 is specifically configured to, when the optimal prediction modes of the M sub-coding blocks are all inter prediction modes, determine the optimal inter prediction mode as the the optimal prediction mode of the coding block; or, when there is a sub-coding block whose optimal prediction mode is the intra-frame prediction mode in the M sub-coding blocks, use the intra-frame prediction mode to predict the coding block, and obtain the The coding block corresponds to the third rate-distortion cost value of the intra prediction mode, and the coding block corresponds to the smaller of the rate-distortion cost value of the optimal inter-frame prediction mode and the third rate-distortion cost value. The prediction mode corresponding to the value is used as the optimal prediction mode for the coding block.

本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本发明的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of the present invention.

所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described systems, devices and units may refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, apparatus and method may be implemented in other manners. For example, the apparatus 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 may be combined or Can be integrated into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of devices or units, and may be in electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as independent products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the 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 are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention. should be included 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 (14)

1. An image encoding method, comprising:
dividing a coding block to be coded into M sub-coding blocks, wherein the coding block is an image block of the image, and M is a positive integer greater than or equal to 2;
predicting the coding block by using an inter-frame 2Nx2N prediction mode, and acquiring a first rate distortion cost value of the coding block corresponding to the inter-frame 2Nx2N prediction mode;
predicting the M sub-coding blocks by using an inter-frame 2Nx2N prediction mode, and acquiring rate distortion cost values of each sub-coding block in the M sub-coding blocks, which respectively correspond to the inter-frame 2Nx2N prediction mode;
determining a first estimation value of the rate distortion cost value of the coding block corresponding to the inter-frame 2NxN prediction mode according to the rate distortion cost value of the M sub-coding blocks corresponding to the inter-frame 2NxN prediction mode;
determining a second estimation value of the rate distortion cost value of the coding block corresponding to the inter-frame Nx2N prediction mode according to the rate distortion cost value of the M sub-coding blocks corresponding to the inter-frame 2Nx2N prediction mode;
determining an optimal prediction mode of the coding block according to the first rate distortion cost value, the first estimation value and the second estimation value;
and performing predictive coding on the coding block according to the optimal prediction mode of the coding block.
2. The method of claim 1, wherein M is 4, and the M sub-coding blocks comprise an upper left sub-coding block, an upper right sub-coding block, a lower left sub-coding block, and a lower right sub-coding block;
the determining a first estimate of the rate-distortion cost value of the coding block corresponding to the inter 2nx2N prediction mode according to the rate-distortion cost values of the M sub-coding blocks corresponding to the inter 2nx2N prediction mode comprises:
determining a third estimation value of the rate distortion cost value of the image block formed by the upper left sub-coding block and the upper right sub-coding block corresponding to the inter-frame 2NxN prediction mode according to the rate distortion cost value of the upper left sub-coding block corresponding to the inter-frame 2Nx2N prediction mode and the rate distortion cost value of the upper right sub-coding block corresponding to the inter-frame 2NxN prediction mode;
determining a fourth estimation value of the rate distortion cost value of the image block formed by the left lower sub-coding block and the right lower sub-coding block corresponding to the inter-frame 2NxN prediction mode according to the rate distortion cost value of the left lower sub-coding block corresponding to the inter-frame 2Nx2N prediction mode and the rate distortion cost value of the right lower sub-coding block corresponding to the inter-frame 2NxN prediction mode;
and calculating the first estimation value according to the third estimation value and the fourth estimation value.
3. The method of claim 1 wherein M is 4, wherein the M sub-coding blocks comprise an upper left sub-coding block, an upper right sub-coding block, a lower left sub-coding block, and a lower right sub-coding block, and wherein determining a second estimate of the rate-distortion cost value of the coding block corresponding to the inter nx2N prediction mode based on the rate-distortion cost values of the M sub-coding blocks corresponding to the inter 2nx2N prediction mode comprises:
determining a fifth estimation value of the rate distortion cost value of the image block formed by the upper left sub-coding block and the lower left sub-coding block corresponding to the inter-frame Nx2N prediction mode according to the rate distortion cost value of the upper left sub-coding block corresponding to the inter-frame 2Nx2N prediction mode and the rate distortion cost value of the lower left sub-coding block corresponding to the inter-frame 2Nx2N prediction mode;
according to the rate-distortion cost value of the upper right sub-coding block corresponding to the inter-frame 2Nx2N prediction mode and the rate-distortion cost value of the lower right sub-coding block corresponding to the inter-frame 2Nx2N prediction mode, determining a sixth estimation value of the rate-distortion cost value of the image block formed by the upper right sub-coding block and the lower right sub-coding block corresponding to the inter-frame Nx2N prediction mode;
and calculating the second estimation value of the coding block according to the fifth estimation value and the sixth estimation value.
4. The method of claim 1, wherein determining the optimal prediction mode for the coding block based on the first rate-distortion cost value, the first estimate, and the second estimate comprises:
determining a minimum of the first rate-distortion cost value, the first estimate, and the second estimate;
when the inter-frame prediction mode corresponding to the minimum value is an inter-frame 2Nx2N prediction mode, taking the inter-frame 2Nx2N prediction mode as the optimal inter-frame prediction mode of the coding block;
and determining the optimal prediction mode of the coding block according to the optimal inter-frame prediction mode.
5. The method of claim 1, wherein determining the optimal prediction mode for the coding block based on the first rate-distortion cost value, the first estimate, and the second estimate comprises:
determining a minimum of the first rate-distortion cost value, the first estimate, and the second estimate;
when the target inter-frame prediction mode corresponding to the minimum value is an inter-frame 2NxN prediction mode or an inter-frame Nx2N prediction mode, predicting the coding block by using the target inter-frame prediction mode, and obtaining a second rate distortion cost value of the coding block corresponding to the target inter-frame prediction mode;
taking the inter-frame prediction mode corresponding to the smaller value of the first rate distortion cost value and the second rate distortion cost value as the optimal inter-frame prediction mode of the coding block;
and determining the optimal prediction mode of the coding block according to the optimal inter-frame prediction mode.
6. The method of claim 4 or 5, wherein the determining the optimal prediction mode for the coding block based on the optimal inter prediction mode for the coding block comprises:
when the rate distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is smaller than or equal to a preset threshold value, taking the optimal inter-frame prediction mode as the optimal prediction mode; or,
when the rate distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is larger than the preset threshold value, predicting the coding block by using an intra-frame prediction mode, acquiring a third rate distortion cost value of the coding block corresponding to the intra-frame prediction mode, and taking a prediction mode corresponding to the smaller value of the rate distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode and the third rate distortion cost value as the optimal prediction mode of the coding block.
7. The method of claim 4 or 5, wherein the determining the optimal prediction mode for the coding block based on the optimal inter prediction mode for the coding block comprises:
when the optimal prediction modes of the M sub-coding blocks are all inter-frame prediction modes, determining the optimal inter-frame prediction mode as the optimal prediction mode of the coding block; or,
when a sub-coding block with the optimal prediction mode being an intra-frame prediction mode exists in the M sub-coding blocks, the intra-frame prediction mode is used for predicting the coding block, a third rate distortion cost value of the coding block corresponding to the intra-frame prediction mode is obtained, and the prediction mode corresponding to the smaller value of the rate distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode and the third rate distortion cost value is used as the optimal prediction mode of the coding block.
8. An image encoder, comprising:
the device comprises a dividing module, a coding module and a decoding module, wherein the dividing module is used for dividing a coding block to be coded into M sub-coding blocks, the coding block is an image block of the image, and M is a positive integer greater than or equal to 2;
an obtaining module, configured to predict the coding block using an inter-frame 2nx2N prediction mode, obtain a first rate-distortion cost value of the coding block corresponding to the inter-frame 2nx2N prediction mode, predict the M sub-coding blocks obtained by dividing by the dividing module using the inter-frame 2nx2N prediction mode, and obtain a rate-distortion cost value of each of the M sub-coding blocks corresponding to the inter-frame 2nx2N prediction mode;
a first determining module, configured to determine, according to the rate-distortion cost values of the M sub-coding blocks obtained by the obtaining module, corresponding to the inter-frame 2nx2N prediction mode, a first estimation value of the rate-distortion cost values of the coding blocks corresponding to the inter-frame 2nx2N prediction mode, and determine, according to the rate-distortion cost values of the M sub-coding blocks corresponding to the inter-frame 2nx2N prediction mode, a second estimation value of the rate-distortion cost values of the coding blocks corresponding to the inter-frame 2nx2N prediction mode;
a second determining module, configured to determine an optimal prediction mode of the coding block according to the first rate-distortion cost value obtained by the obtaining module, the first estimation value and the second estimation value determined by the first determining module;
and the coding module is used for carrying out predictive coding on the coding block according to the optimal prediction mode of the coding block determined by the second determining module.
9. The image encoder of claim 8, wherein M is 4, the M sub-coding blocks comprise an upper left sub-coding block, an upper right sub-coding block, a lower left sub-coding block, and a lower right sub-coding block, and the first determining module is specifically configured to determine a third estimate of the rate-distortion cost value of the image block consisting of the upper left sub-coding block and the upper right sub-coding block corresponding to the inter 2nx2N prediction mode based on the rate-distortion cost value of the upper left sub-coding block corresponding to the inter 2nx2N prediction mode and the rate-distortion cost value of the upper right sub-coding block corresponding to the inter 2nx2N prediction mode; determining a fourth estimation value of the rate distortion cost value of the image block formed by the left lower sub-coding block and the right lower sub-coding block corresponding to the inter-frame 2NxN prediction mode according to the rate distortion cost value of the left lower sub-coding block corresponding to the inter-frame 2Nx2N prediction mode and the rate distortion cost value of the right lower sub-coding block corresponding to the inter-frame 2NxN prediction mode; and calculating the first estimation value according to the third estimation value and the fourth estimation value.
10. The image encoder of claim 8, wherein M is 4, the M sub-coding blocks comprise an upper left sub-coding block, an upper right sub-coding block, a lower left sub-coding block, and a lower right sub-coding block, and the first determining module is specifically configured to determine a fifth estimate of the rate-distortion cost value of the image block consisting of the upper left sub-coding block and the lower left sub-coding block corresponding to the inter-nx 2N prediction mode based on the rate-distortion cost value of the upper left sub-coding block corresponding to the inter-2 nx2N prediction mode and the rate-distortion cost value of the lower left sub-coding block corresponding to the inter-2 nx2N prediction mode; according to the rate-distortion cost value of the upper right sub-coding block corresponding to the inter-frame 2Nx2N prediction mode and the rate-distortion cost value of the lower right sub-coding block corresponding to the inter-frame 2Nx2N prediction mode, determining a sixth estimation value of the rate-distortion cost value of the image block formed by the upper right sub-coding block and the lower right sub-coding block corresponding to the inter-frame Nx2N prediction mode; and calculating the second estimation value of the coding block according to the fifth estimation value and the sixth estimation value.
11. The image encoder of claim 8, wherein the second determination module is specifically configured to determine a minimum of the first rate-distortion cost value, the first estimate, and the second estimate; when the inter-frame prediction mode corresponding to the minimum value is an inter-frame 2Nx2N prediction mode, taking the inter-frame 2Nx2N prediction mode as the optimal inter-frame prediction mode of the coding block; and determining the optimal prediction mode of the coding block according to the optimal inter-frame prediction mode.
12. The image encoder of claim 8, wherein the second determination module is specifically configured to determine a minimum of the first rate-distortion cost value, the first estimate, and the second estimate; when the target inter-frame prediction mode corresponding to the minimum value is an inter-frame 2NxN prediction mode or an inter-frame Nx2N prediction mode, predicting the coding block by using the target inter-frame prediction mode, and obtaining a second rate distortion cost value of the coding block corresponding to the target inter-frame prediction mode; taking the inter-frame prediction mode corresponding to the smaller value of the first rate distortion cost value and the second rate distortion cost value as the optimal inter-frame prediction mode of the coding block; and determining the optimal prediction mode of the coding block according to the optimal inter-frame prediction mode.
13. The image encoder according to claim 11 or 12, wherein the second determining module is specifically configured to take the optimal inter prediction mode as the optimal prediction mode when a rate-distortion cost value of the coding block corresponding to the optimal inter prediction mode is smaller than or equal to a preset threshold; or when the rate distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode is larger than the preset threshold value, predicting the coding block by using an intra-frame prediction mode, acquiring a third rate distortion cost value of the coding block corresponding to the intra-frame prediction mode, and taking the prediction mode corresponding to the smaller value of the rate distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode and the third rate distortion cost value as the optimal prediction mode of the coding block.
14. The image encoder according to claim 11 or 12, wherein the second determining module is specifically configured to determine the optimal inter prediction mode as the optimal prediction mode of the coding block when the optimal prediction modes of the M sub-coding blocks are all inter prediction modes; or when a sub-coding block of which the optimal prediction mode is the intra-frame prediction mode exists in the M sub-coding blocks, predicting the coding block by using the intra-frame prediction mode, acquiring a third rate distortion cost value of the coding block corresponding to the intra-frame prediction mode, and taking the prediction mode corresponding to the smaller value of the rate distortion cost value of the coding block corresponding to the optimal inter-frame prediction mode and the third rate distortion cost value as the optimal prediction mode of the coding block.
CN201510346340.4A 2015-06-19 2015-06-19 Image coding method and image encoder Expired - Fee Related CN106331699B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510346340.4A CN106331699B (en) 2015-06-19 2015-06-19 Image coding method and image encoder

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510346340.4A CN106331699B (en) 2015-06-19 2015-06-19 Image coding method and image encoder

Publications (2)

Publication Number Publication Date
CN106331699A CN106331699A (en) 2017-01-11
CN106331699B true CN106331699B (en) 2019-04-26

Family

ID=57729228

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510346340.4A Expired - Fee Related CN106331699B (en) 2015-06-19 2015-06-19 Image coding method and image encoder

Country Status (1)

Country Link
CN (1) CN106331699B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111988612B (en) * 2020-08-28 2023-05-02 北京奇艺世纪科技有限公司 Video coding processing method and device and electronic equipment
CN112702598B (en) * 2020-12-03 2024-06-04 浙江智慧视频安防创新中心有限公司 Method, device, electronic device and medium for encoding and decoding based on bit shift operation

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022555A (en) * 2007-02-12 2007-08-22 清华大学 Interframe predictive coding mode quick selecting method
CN101150722A (en) * 2007-11-13 2008-03-26 同济大学 Fast mode determination method and device in video coding
KR20090069843A (en) * 2007-12-26 2009-07-01 호서대학교 산학협력단 Fast Determination of Coding Mode for Macroblocks
CN101640802A (en) * 2009-08-28 2010-02-03 北京工业大学 Video inter-frame compression coding method based on macroblock features and statistical properties
CN104333756A (en) * 2014-11-19 2015-02-04 西安电子科技大学 HEVC (High Efficiency Video Coding) prediction mode fast selection method based on time domain correlation

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8275046B2 (en) * 2008-09-19 2012-09-25 Texas Instruments Incorporated Fast macroblock structure decision using SAD discrepancy and its prediction mode

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101022555A (en) * 2007-02-12 2007-08-22 清华大学 Interframe predictive coding mode quick selecting method
CN101150722A (en) * 2007-11-13 2008-03-26 同济大学 Fast mode determination method and device in video coding
KR20090069843A (en) * 2007-12-26 2009-07-01 호서대학교 산학협력단 Fast Determination of Coding Mode for Macroblocks
CN101640802A (en) * 2009-08-28 2010-02-03 北京工业大学 Video inter-frame compression coding method based on macroblock features and statistical properties
CN104333756A (en) * 2014-11-19 2015-02-04 西安电子科技大学 HEVC (High Efficiency Video Coding) prediction mode fast selection method based on time domain correlation

Also Published As

Publication number Publication date
CN106331699A (en) 2017-01-11

Similar Documents

Publication Publication Date Title
JP6275889B2 (en) Method and apparatus for encoding / decoding motion vectors based on reduced predicted motion vector candidates
KR20250040609A (en) Method for intra prediction and apparatus thereof
JP6276336B2 (en) Video decoding method and video decoding apparatus
JP6076435B2 (en) Video intra prediction encoding method, intra prediction decoding method, and apparatus thereof
JP5624179B2 (en) Video decoding device
KR101376673B1 (en) Methods For Encoding/Decoding High Definition Image And Apparatuses For Performing The Same
KR101387467B1 (en) Methods For Encoding/Decoding High Definition Image And Apparatuses For Performing The Same
CN103024378B (en) Movable information deriving method and device in a kind of coding and decoding video
CN101766030A (en) Use video coding and the coding/decoding method and the equipment of weight estimation
WO2012167539A1 (en) Method and device for intra-frame prediction mode processing
KR20140110806A (en) Method for video decoding and computer readable redording meduim thereof
CN107113438A (en) Intra-frame encoding mode
CN103327327B (en) For the inter prediction encoding unit selection method of high-performance video coding HEVC
KR20120049435A (en) Method and apparatus for compressing video using template matching and motion prediction
CN106331699B (en) Image coding method and image encoder
JP2015211386A (en) Dynamic image encoding device, dynamic image encoding method, and computer program for dynamic image encoding
WO2012081895A1 (en) Intra prediction method and apparatus
TW201501511A (en) Prediction method and system in image compression
CN104253997A (en) Intra prediction method and system
KR101477545B1 (en) Method for decoding motion vector
KR101477546B1 (en) Apparatus for decoding motion vector
KR101711894B1 (en) Method and apparatus for encoding video using coding information in upper depth
JP6323185B2 (en) Moving picture coding apparatus, moving picture coding method, and moving picture coding computer program
KR101454664B1 (en) Method for decoding motion vector
JP2019146252A (en) Method and device for encoding/decoding motion vector based on reduced prediction motion vector candidate

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190426

CF01 Termination of patent right due to non-payment of annual fee