CN101867818B - Selection method and device of macroblock mode - Google Patents
Selection method and device of macroblock mode Download PDFInfo
- Publication number
- CN101867818B CN101867818B CN 201010184776 CN201010184776A CN101867818B CN 101867818 B CN101867818 B CN 101867818B CN 201010184776 CN201010184776 CN 201010184776 CN 201010184776 A CN201010184776 A CN 201010184776A CN 101867818 B CN101867818 B CN 101867818B
- Authority
- CN
- China
- Prior art keywords
- mode
- coding
- macroblock
- cost
- frame
- 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
Links
- 238000010187 selection method Methods 0.000 title claims abstract description 19
- 238000000034 method Methods 0.000 claims abstract description 22
- 208000037170 Delayed Emergence from Anesthesia Diseases 0.000 claims description 14
- 238000013139 quantization Methods 0.000 claims description 14
- 238000004364 calculation method Methods 0.000 claims description 4
- 241000630665 Hada Species 0.000 description 4
- 238000010586 diagram Methods 0.000 description 3
- 238000005457 optimization Methods 0.000 description 2
- 230000002123 temporal effect Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 230000007812 deficiency Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
Images
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
Description
技术领域 technical field
本发明涉及视频编码技术领域,特别地,涉及视频压缩编码的宏块模式选择的快速选择方法和装置。 The present invention relates to the technical field of video coding, in particular, to a fast selection method and device for macroblock mode selection of video compression coding. the
背景技术 Background technique
在各视频编码标准中,如H.264/AVC(Advanced Video Coding),AVS(AudioVideo coding Standard先进音频视频编码标准)均规定了码流结构和解码过程,但并没有描述具体的编码方法。而模式选择是视频编码中的核心技术,因此是学术研究的热点。 In each video coding standard, such as H.264/AVC (Advanced Video Coding), AVS (AudioVideo coding Standard Advanced Audio Video Coding Standard) all stipulate the code stream structure and decoding process, but do not describe the specific coding method. Mode selection is the core technology in video coding, so it is a hotspot of academic research. the
由于大多数的编码标准都是采用宏块为基本单位的编码方式,所以模式选择是基于宏块的编码模式进行选择。从现有的技术来看模式选择均是比较各个模式间的编码代价函数,选择出编码代价函数最小的模式为当前宏块的最终模式。编码的代价函数在采用率失真优化(RDO:Rate-Distortion-Optimization)时为对应编码模式的率失真代价(RDCost:Rate-Distortion cost)由于率失真代价的计算很复杂,所以有人提出了其它的计算代价函数的方法,但计算量仍很大,特别是当运动估计精度较高时,一次性在高精度下做运动估计的复杂度非常高。而且在对于特殊模式,例如跳过(SKIP)模式,模式选择的快速算法中均没有利用代价函数进行比较计算,这样会大大降低了模式选择的准确性。 Since most coding standards use a macroblock as the basic unit of coding, the mode selection is based on the coding mode of the macroblock. According to the existing technology, the mode selection is to compare the coding cost functions among the various modes, and select the mode with the smallest coding cost function as the final mode of the current macroblock. The cost function of encoding is the rate-distortion cost (RDCost: Rate-Distortion cost) of the corresponding encoding mode when rate-distortion optimization (RDO: Rate-Distortion-Optimization) is adopted. Since the calculation of the rate-distortion cost is very complicated, some people have proposed other The method of calculating the cost function, but the amount of calculation is still very large, especially when the motion estimation accuracy is high, the complexity of doing motion estimation with high precision at one time is very high. Moreover, for special modes, such as skipping (SKIP) mode, the fast algorithm for mode selection does not use the cost function for comparison calculation, which will greatly reduce the accuracy of mode selection. the
发明内容 Contents of the invention
本发明的目的在于针对现有技术的不足,提供了宏块模式的快速选择方法和装置。 The object of the present invention is to provide a method and device for fast selection of a macroblock mode in view of the deficiencies in the prior art. the
本发明的目的是通过以下技术方案来实现的: The purpose of the present invention is achieved by the following technical solutions:
一种宏块模式的选择方法,先比较低精度运动估计下的第一类帧间模式的编码代价,选出编码代价最优的模式作为第一类帧间模式的选择结果,再对选 出的模式进行高精度的运动估计以获得高精度运动估计下该模式的最优的编码代价。该编码代价再与最优的帧内模式和最优的第二类帧间模式的编码代价比较以选择编码代价较优的模式。这里的第一类帧间模式指的是需要进行运动搜索的帧间编码模式,第二类帧间模式指的是不需要进行运动搜索的帧间编码模式,较优的编码模式指的是编码代价较小或其它与编码代价大小相结合的评判标准选取出的编码模式。 A method for selecting a macroblock mode, first comparing the encoding costs of the first type of inter-frame mode under low-precision motion estimation, and selecting the mode with the best encoding cost as the selection result of the first type of inter-frame mode, and then selecting High-precision motion estimation is performed in the mode to obtain the optimal coding cost of this mode under high-precision motion estimation. The encoding cost is then compared with the encoding costs of the optimal intra mode and the optimal second-type inter mode to select a mode with a better encoding cost. The first type of inter-frame mode here refers to the inter-frame coding mode that requires motion search, the second type of inter-frame mode refers to the inter-frame coding mode that does not require motion search, and the better coding mode refers to the encoding The coding mode selected by the small cost or other judging criteria combined with the coding cost. the
一种用于所述宏块模式的选择方法的装置。它包括:低精度像素第一类帧间模式选择器,高精度像素运动估计器,帧内模式选择器,第二类帧间模式选择器和模式判决器。其中,低精度像素第一类帧间模式选择器的输出端接高精度像素运动估计器的输入端,输出第一类帧间模式中最优的编码模式及该编码模式下宏块的编码代价。高精度像素运动估计器的输出端接模式判决器,输出对应的模式及高精度运动估计后该编码模式下宏块的编码代价。帧内模式选择器的输出端接模式判决器,输出最优的帧内模式及该编码模式下宏块的编码代价。第二类帧间模式选择器的输出端接模式判决器,输出第二类帧间模式中,最优的编码模式及该编码模式下宏块的编码代价。模式判决器的一个输入端接高精度像素运动估计器,一个输入端接帧内模式选择器,还有一个输入端接第二类帧间模式选择器,输出三个输入的模式中最优的模式。 An apparatus for the selection method of the macroblock mode. It includes: a low-precision pixel first-type inter-frame mode selector, a high-precision pixel motion estimator, an intra-frame mode selector, a second-type inter-frame mode selector and a mode decision device. Among them, the output terminal of the low-precision pixel first-type inter-frame mode selector is connected to the input terminal of the high-precision pixel motion estimator, and outputs the optimal coding mode in the first-type inter-frame mode and the coding cost of the macroblock in this coding mode . The output terminal of the high-precision pixel motion estimator is connected to the mode decision device, which outputs the corresponding mode and the coding cost of the macroblock in the coding mode after the high-precision motion estimation. The output terminal of the intra-frame mode selector is connected to the mode decision device, which outputs the optimal intra-frame mode and the coding cost of the macroblock in this coding mode. The output terminal of the second-type inter-frame mode selector is connected to the mode decision device, which outputs the optimal coding mode and the coding cost of the macroblock in the second-type inter-frame mode. One input terminal of the mode decision device is connected to the high-precision pixel motion estimator, one input terminal is connected to the intra-frame mode selector, and the other input terminal is connected to the second-type inter-frame mode selector, and the best of the three input modes is output model. the
一种宏块模式的选择方法,对宏块的SKIP模式采用预测残差块绝对值大小的门限判决与编码代价函数比较相结合的方法进行选择,即当SKIP模式下预测残差块的绝对值小于一个与由宏块量化参数大小决定的门限,并且SKIP的编码代价优于除SKIP模式外的其它模式中最优模式的编码代价时当前宏块选择SKIP模式;否则,当前宏块选择除SKIP模式外的其它模式中最优的编码模式。这里较优的编码模式指的是编码代价较小或其它与编码代价大小相结合的评判标准选取出的编码模式。 A method for selecting a macroblock mode. The SKIP mode of a macroblock is selected by combining the threshold judgment of the absolute value of the predicted residual block with the comparison of the encoding cost function, that is, when the absolute value of the predicted residual block in the SKIP mode is less than a threshold determined by the size of the macroblock quantization parameter, and the encoding cost of SKIP is better than the encoding cost of the optimal mode in other modes except SKIP mode, the current macroblock selects SKIP mode; otherwise, the current macroblock selects SKIP mode The optimal encoding mode among other modes except mode. Here, a better coding mode refers to a coding mode selected with a smaller coding cost or other criteria combined with the size of the coding cost. the
一种用于上述宏块模式的选择方法的装置,它包括残差绝对值比较器,第一编码代价计算器,第二编码代价计算器,模式选择器。其中,残差绝对值比较器的输出端接模式选择器,输出残差绝对值是否大于门限的信号。第一编码代价计算器的输出端接模式选择器,输出除SKIP模式外其它模式中最优的模式及该模式下宏块的编码代价。第二编码代价计算器的输出端接模式选择器,输出SKIP模式的编码代价。模式选择器的三个输入端分别接残差绝对值比较器、第一编码代价计算器和第二编码代价计算器。输出最终选定的编码模式。 A device used in the selection method of the above-mentioned macroblock mode, which includes a residual absolute value comparator, a first encoding cost calculator, a second encoding cost calculator, and a mode selector. Wherein, the output terminal of the residual absolute value comparator is connected to the mode selector, and outputs a signal indicating whether the residual absolute value is greater than a threshold. The output terminal of the first encoding cost calculator is connected to the mode selector, and outputs the optimal mode among other modes except SKIP mode and the encoding cost of the macroblock in this mode. The output terminal of the second coding cost calculator is connected to the mode selector, and outputs the coding cost of the SKIP mode. The three input ends of the mode selector are respectively connected to the residual absolute value comparator, the first encoding cost calculator and the second encoding cost calculator. Output the final selected encoding mode. the
本发明的有益效果是,本发明在极大地减少了计算复杂度的条件下仍能准 确地选取最优的宏块编码模式,同时对SKIP模式的精细判决,提高了SKIP模式的选择的准确性。 The beneficial effect of the present invention is that the present invention can still accurately select the optimal macroblock coding mode under the condition of greatly reducing the computational complexity, and at the same time, the fine judgment of the SKIP mode improves the accuracy of the selection of the SKIP mode sex. the
附图说明 Description of drawings
图1是本发明实施例4的宏块模式的选择装置的结构框图; Fig. 1 is the structural block diagram of the selection device of the macroblock mode of embodiment 4 of the present invention;
图2是本发明实施例5的宏块模式的选择装置的结构框图; Fig. 2 is the structural block diagram of the selection device of the macroblock mode of embodiment 5 of the present invention;
图3是本发明实施例6的宏块模式的选择装置的结构框图。 Fig. 3 is a structural block diagram of an apparatus for selecting a macroblock mode according to Embodiment 6 of the present invention. the
具体实施方式 Detailed ways
下面根据附图和实施例详细说明本发明,本发明的目的和效果将变得更加明显。 The purpose and effect of the present invention will become more obvious according to the present invention in detail according to the accompanying drawings and embodiments. the
本发明的技术方案主要是依据编码代价函数在各模式间选择出编码代价最小的编码模式以获得视频编码系统编码性能的提高。 The technical proposal of the present invention mainly selects the coding mode with the smallest coding cost among various modes according to the coding cost function to improve the coding performance of the video coding system. the
下面是本发明的具体实施方法: Below is the concrete implementation method of the present invention:
实施例1: Example 1:
以AVS标准为例,在AVS标准中,宏块模式分为帧间编码模式和帧内编码模式两大类。帧间编码模式又可以按照子块的尺寸分为16×16,16×8,8×16,8×8模式,除此之外,帧间还存在特殊的编码模式,如P条带中的SKIP模式,B中的SKIP和DIRECT模式。帧内编码模式是按照8×8块的大小进行预测编码的,一共存在5种帧内编码模式:水平模式,竖直模式,右下模式,左下模式,DC模式。对于每个宏块,需要在这些编码模式中选择一个编码效率高的模式进行编码。下面是以AVS标准中的B条带中的宏块模式选择为例说明权利要求1所述的宏块模式的选择方法。 Taking the AVS standard as an example, in the AVS standard, macroblock modes are divided into two categories: inter-frame coding mode and intra-frame coding mode. The inter-frame coding mode can be divided into 16×16, 16×8, 8×16, and 8×8 modes according to the size of the sub-block. In addition, there are special coding modes between frames, such as the P slice. SKIP mode, SKIP and DIRECT mode in B. The intra-frame coding mode is predictively coded according to the size of 8×8 blocks, and there are 5 kinds of intra-frame coding modes: horizontal mode, vertical mode, lower-right mode, lower-left mode, and DC mode. For each macroblock, it is necessary to select a mode with high coding efficiency among these coding modes for coding. The method for selecting the macroblock mode according to claim 1 is described below by taking the selection of the macroblock mode in the B slice in the AVS standard as an example. the
具体的实施步骤如下: The specific implementation steps are as follows:
步骤1,采用下面的代价函数在帧间模式16×16,16×8,8×16,8×8模式中选出一个编码代价最小的一个模式。将选出宏块模式的编码代价记作minCost_inter_int。 Step 1: Use the following cost function to select a mode with the smallest coding cost among the inter-frame modes 16×16, 16×8, 8×16, and 8×8. The encoding cost of the selected macroblock mode is recorded as minCost_inter_int. the
Cost_inter_int=SAD_int+λ×(mode_bits+motion_bits) Cost_inter_int=SAD_int+λ×(mode_bits+motion_bits)
其中SAD_int为当前模式下整像素精度运动搜索后的残差块的绝对值和,mode_bits是该模式的模式信息在码流中传递需要的比特数,motion_bits是运动 矢量在码流中传递需要的比特数,λ取0.67×QP,这里QP指的是当前宏块的量化参数。 Among them, SAD_int is the absolute value sum of the residual block after integer pixel precision motion search in the current mode, mode_bits is the number of bits required for the mode information of this mode to be transmitted in the code stream, and motion_bits is the bits required for the motion vector to be transmitted in the code stream λ is 0.67×QP, where QP refers to the quantization parameter of the current macroblock. the
步骤2,计算步骤1选出的模式在1/4像素精度运动搜索后的编码代价 Step 2, calculate the encoding cost of the mode selected in step 1 after 1/4 pixel precision motion search
minCost_inter_qua=min_SAD_qua+λ×(mode_bits+motion_bits) minCost_inter_qua=min_SAD_qua+λ×(mode_bits+motion_bits)
其中min_SAD_qua为步骤1中选出的模式在1/4像素运动搜索后的残差块的绝对值和,mode_bits是该模式在码流中传递需要的比特数,motion_bits是运动矢量在码流中传递需要的比特数,λ取0.67×QP,这里QP指的是当前宏块的量化参数。 Where min_SAD_qua is the absolute value sum of the residual block after the 1/4 pixel motion search of the mode selected in step 1, mode_bits is the number of bits required for the mode to be transmitted in the code stream, and motion_bits is the motion vector transmitted in the code stream The number of bits required, λ is 0.67×QP, where QP refers to the quantization parameter of the current macroblock. the
步骤3,利用下面的代价函数在帧内的五种模式中选取一个编码代价最小的帧内模式。将选出的宏块模式的编码代价记作minCost_intra。 Step 3, using the following cost function to select an intra-frame mode with the smallest encoding cost among the five intra-frame modes. The encoding cost of the selected macroblock mode is denoted as minCost_intra. the
Cost_intra=SAD_intra+λ×mode_bits+H Cost_intra=SAD_intra+λ×mode_bits+H
其中SAD_intra为当前模式下帧内预测后的预测残差块的绝对值和,mode_bits是该模式的模式信息在码流中传递需要的比特数。λ取0.67×QP。H为帧内cost的修正量,这里取为18。 Wherein SAD_intra is the absolute value sum of prediction residual blocks after intra prediction in the current mode, and mode_bits is the number of bits required for the mode information of this mode to be transmitted in the code stream. λ takes 0.67×QP. H is the correction amount of the intra-frame cost, which is taken as 18 here. the
步骤4,比较步骤1和步骤3中选出模式的编码代价,即minCost_inter_qua和minCost_intra的大小,如果minCost_inter_qua较大,则将步骤2中选出的模式设为候选模式,否则将步骤1中的模式设为候选模式。 Step 4, compare the encoding cost of the mode selected in step 1 and step 3, that is, the size of minCost_inter_qua and minCost_intra, if minCost_inter_qua is larger, set the mode selected in step 2 as a candidate mode, otherwise set the mode in step 1 Set to candidate mode. the
步骤5,将步骤4中选出的候选模式的编码代价与帧间特殊模式中的最优编码模式的编码代价进行比较,这里的特殊模式指的是DIRECT模式和SKIP模式。选取编码代价最小的模式作为当前宏块最终的编码模式。特殊模式的编码代价按照下面的方法计算。 Step 5: Compare the coding cost of the candidate mode selected in step 4 with the coding cost of the optimal coding mode in the inter-frame special mode, where the special mode refers to DIRECT mode and SKIP mode. Select the mode with the least coding cost as the final coding mode of the current macroblock. The encoding cost of the special mode is calculated as follows. the
Cost_special=SAD_special+λ×mode_bits Cost_special=SAD_special+λ×mode_bits
其中SAD_special为特殊模式预测后的残差块的绝对值和,mode_bits是该模式的模式信息在码流中传递需要的比特数,λ取0.67×QP,这里QP指的是当前宏块的量化参数。 Among them, SAD_special is the absolute value sum of the residual block predicted by the special mode, mode_bits is the number of bits required for the mode information of this mode to be transmitted in the code stream, and λ is 0.67×QP, where QP refers to the quantization parameter of the current macroblock . the
实施例2: Example 2:
下面是以AVS标准中的P条带中宏块模式的选择方法为例说明权利要求6所述的宏块模式的选择方法。 The method for selecting the macroblock mode in claim 6 is described below by taking the method for selecting the macroblock mode in the P slice in the AVS standard as an example. the
具体的实施步骤如下: The specific implementation steps are as follows:
步骤1,采用下面的代价函数在除SKIP模式的其它候选模式中选出一个编码代价最小的一个模式。将选出宏块模式的编码代价记作minCost_normal。 Step 1: Use the following cost function to select a mode with the smallest encoding cost from other candidate modes except SKIP mode. The coding cost of the selected macroblock mode is recorded as minCost_normal. the
Cost_normal=η×num_nozero+λ×(mode_bits+motion_bits)+H Cost_normal=η×num_nozero+λ×(mode_bits+motion_bits)+H
其中num_nozero为当前模式该宏块预测残差块中非零系数的个数,mode_bits是该模式的模式信息在码流中传递需要的比特数,motion_bits是运动矢量在码流中传递需要的比特数,η取10×QP,λ取0.69×QP,这里QP指的是当前宏块的量化参数。 Where num_nozero is the number of non-zero coefficients in the macroblock prediction residual block in the current mode, mode_bits is the number of bits required for the mode information of this mode to be transmitted in the code stream, and motion_bits is the number of bits required for the motion vector to be transmitted in the code stream , η takes 10×QP, and λ takes 0.69×QP, where QP refers to the quantization parameter of the current macroblock. the
步骤2,将步骤1中选出的候选模式与SKIP模式的编码代价进行比较,SKIP模式的编码代价按照下面方法进行计算。 Step 2, compare the candidate mode selected in step 1 with the coding cost of the SKIP mode, and the coding cost of the SKIP mode is calculated according to the following method. the
Cost_skip=α×SAD_Skip+β×skipmode_bits Cost_skip=α×SAD_Skip+β×skipmode_bits
SAD_Skip为SKIP模式补偿后宏块残差的绝对值和,skipmode_bits为码流中传递SKIP模式的模式信息需要的比特数,α取为0.85,β取为0.62×QP,这里QP指的是当前宏块的量化参数。 SAD_Skip is the absolute value sum of macroblock residuals after SKIP mode compensation, skipmode_bits is the number of bits required to transmit the mode information of SKIP mode in the code stream, α is taken as 0.85, and β is taken as 0.62×QP, where QP refers to the current macro The quantization parameter of the block. the
如果Cost_skip小于minCost_normal并且SAD_Skip<Th(QP),则宏块的最终编码模式为SKIP模式,否则将步骤1中选出的模式作为当前宏块最终的编码模式。 If Cost_skip is smaller than minCost_normal and SAD_Skip<Th(QP), then the final coding mode of the macroblock is SKIP mode, otherwise, the mode selected in step 1 is used as the final coding mode of the current macroblock. the
实施例3: Example 3:
以H.264标准为例,在H.264标准中,宏块模式分为帧间编码模式和帧内编码模式两大类。帧间编码模式又可以按照子块的尺寸分为16×16,16×8,8×16,8×8,8×4,4×8,4×4模式,除此之外,帧间还存在特殊的编码模式,如P slice中的SKIP模式,B中的SKIP和DIRECT模式,DIRECT模式又分为空间DIRECT模式,时间DIRECT模式。帧内编码模式分为16×16和4×4两类。其中16×16存在4种模式:垂直模式,水平模式,DC模式,平面模式;4×4块存在9种帧内编码模式:水平模式,竖直模式,右下模式,左下模式,DC模式,下左对角线模式,下右对角线模式,右垂直模式,下水平模式,左垂直模式,上水平模式。对于每个宏块,需要在这些编码模式中选择一个编码效率高的模式进行编码。下面是以H.264标准中的B条带中的模式选择为例说明权利要求9所述的宏块模式的选择方法。 Taking the H.264 standard as an example, in the H.264 standard, the macroblock mode is divided into two categories: an inter-frame coding mode and an intra-frame coding mode. The inter-frame coding mode can be divided into 16×16, 16×8, 8×16, 8×8, 8×4, 4×8, 4×4 modes according to the size of the sub-block. In addition, the inter-frame also There are special coding modes, such as SKIP mode in P slice, SKIP and DIRECT mode in B, and DIRECT mode is divided into space DIRECT mode and time DIRECT mode. There are two types of intra-frame encoding modes: 16×16 and 4×4. Among them, there are 4 modes in 16×16: vertical mode, horizontal mode, DC mode, and planar mode; there are 9 intra-frame coding modes in 4×4 blocks: horizontal mode, vertical mode, lower right mode, lower left mode, DC mode, Lower left diagonal mode, lower right diagonal mode, right vertical mode, lower horizontal mode, left vertical mode, upper horizontal mode. For each macroblock, it is necessary to select a mode with high coding efficiency among these coding modes for coding. The method for selecting a macroblock mode according to claim 9 is described below by taking mode selection in a B slice in the H.264 standard as an example. the
具体的实施步骤如下: The specific implementation steps are as follows:
步骤1,采用下面的代价函数在帧间模式16×16,16×8,8×16,8×8,8×4,4×8,4×4模式中选出一个编码代价最小的一个模式。将选出宏块模式的编码代价记作minCost_inter_int。 Step 1, use the following cost function to select a mode with the smallest coding cost in the inter mode 16×16, 16×8, 8×16, 8×8, 8×4, 4×8, 4×4 mode . The encoding cost of the selected macroblock mode is recorded as minCost_inter_int. the
Cost_inter_int4=SATD_int+λ×(mode_bits+motion_bits) Cost_inter_int4=SATD_int+λ×(mode_bits+motion_bits)
其中SATD_int4为当前模式下4倍整像素精度运动搜索后的残差块的哈达吗变换后的绝对值和,mode_bits是该模式在码流中传递需要的比特数,motion_bits是运动矢量在码流中传递需要的比特数,λ取0.68×QP,这里QP指的是当前宏块的量化参数。 Among them, SATD_int4 is the absolute value sum of the Hada transform of the residual block after 4 times integer pixel precision motion search in the current mode, mode_bits is the number of bits required for this mode to be transmitted in the code stream, and motion_bits is the motion vector in the code stream To transmit the required number of bits, λ is 0.68×QP, where QP refers to the quantization parameter of the current macroblock. the
步骤2,计算步骤1选出的模式在整像素精度运动搜索后的编码代价 Step 2, calculate the encoding cost of the mode selected in step 1 after the whole pixel precision motion search
minCost_inter_int=SATD_int+λ×(mode_bits+motion_bits) minCost_inter_int=SATD_int+λ×(mode_bits+motion_bits)
其中SATD_int为步骤1中选出的模式在整像素精度运动搜索后的残差块的哈达吗变换后的绝对值和,mode_bits是该模式的模式信息在码流中传递需要的比特数,motion_bits是运动矢量在码流中传递需要的比特数,λ取0.68×QP,这里QP指的是当前宏块的量化参数。 Among them, SATD_int is the absolute value sum after the Hada transform of the residual block of the mode selected in step 1 after the whole-pixel precision motion search, mode_bits is the number of bits required for the mode information of this mode to be transmitted in the code stream, and motion_bits is The motion vector transmits the required number of bits in the code stream, and λ is 0.68×QP, where QP refers to the quantization parameter of the current macroblock. the
步骤3,利用下面的代价函数在帧内的9种模式中选取一个编码代价最小的帧内模式。将选出的宏块模式的编码代价记作minCost_intra。 Step 3, using the following cost function to select an intra-frame mode with the smallest encoding cost among the nine intra-frame modes. The encoding cost of the selected macroblock mode is denoted as minCost_intra. the
Cost_intra=SATD_intra+λ×mode_bits+H Cost_intra=SATD_intra+λ×mode_bits+H
其中SATD_intra为当前模式下帧内预测后的残差块的哈达吗变换后的绝对值和,mode_bits是该模式的模式信息在码流中传递需要的比特数,λ取0.68×QP,这里QP指的是当前宏块的量化参数,H为帧内cost的修正量,取为20。 Among them, SATD_intra is the absolute value sum of the Hada transform of the residual block after intra prediction in the current mode, mode_bits is the number of bits required for the mode information of this mode to be transmitted in the code stream, and λ is 0.68×QP, where QP refers to is the quantization parameter of the current macroblock, and H is the correction amount of the intra-frame cost, which is taken as 20. the
步骤4,比较步骤1和步骤3中选出模式的编码代价,即minCost_inter_int和minCost_intra的大小,如果minCost_inter_int较大,则将步骤3中选出的模式设为候选模式,否则将步骤1中的模式设为候选模式。 Step 4, compare the encoding cost of the mode selected in step 1 and step 3, that is, the size of minCost_inter_int and minCost_intra, if minCost_inter_int is larger, set the mode selected in step 3 as a candidate mode, otherwise set the mode in step 1 Set to candidate mode. the
步骤5,将步骤4中选出的候选模式与最优的DIRECT模式的编码代价进行比较,选取编码代价较小的模式作为新的候选模式。设此时选出的模式的编码代价是minCost_normal。DIRECT模式包括时间DIRECT模式和空间DIRECT模式,它们的编码代价均按照下面的方法计算。 Step 5, compare the coding cost of the candidate mode selected in step 4 with the optimal DIRECT mode, and select the mode with the lower coding cost as a new candidate mode. Let the encoding cost of the mode selected at this time be minCost_normal. The DIRECT mode includes a temporal DIRECT mode and a spatial DIRECT mode, and their coding costs are calculated according to the following method. the
Cost_direct=SATD_direct+λ×mode_bits Cost_direct=SATD_direct+λ×mode_bits
其中SATD_direct为DIRECT模式预测后的残差块的哈达吗变换后的绝对值和,mode_bits是DIRECT模式的模式信息在码流中需要传递的比特数,λ取0.68×QP,这里QP指的是当前宏块的量化参数。 Among them, SATD_direct is the absolute value sum of the Hada transform of the residual block after DIRECT mode prediction, mode_bits is the number of bits that the mode information of DIRECT mode needs to transmit in the code stream, and λ is 0.68×QP, where QP refers to the current The quantization parameter of the macroblock. the
步骤6,将步骤5中选出的候选模式与SKIP模式的编码代价进行比较,SKIP模式的编码代价按照下面方法进行计算。 Step 6, compare the candidate mode selected in step 5 with the encoding cost of the SKIP mode, and the encoding cost of the SKIP mode is calculated according to the following method. the
Cost_skip=α×SAD_Skip+β×skipmode_bits Cost_skip=α×SAD_Skip+β×skipmode_bits
SAD_Skip为SKIP模式补偿后宏块残差的绝对值和,skipmode_bits是SKIP模式在码流中需要传递的比特数,α取为0.8,β取为0.63×QP,这里QP指的 是当前宏块的量化参数。 SAD_Skip is the absolute value sum of macroblock residuals after SKIP mode compensation, skipmode_bits is the number of bits that need to be transmitted in the code stream in SKIP mode, α is taken as 0.8, and β is taken as 0.63×QP, where QP refers to the current macroblock quantization parameters. the
如果Cost_skip小于minCost_normal并且SAD_Skip<Th(QP),则宏块的最终编码模式为SKIP模式,否则将步骤5中选出的模式作为当前宏块最终的编码模式。 If Cost_skip is smaller than minCost_normal and SAD_Skip<Th(QP), the final coding mode of the macroblock is SKIP mode, otherwise, the mode selected in step 5 is used as the final coding mode of the current macroblock. the
实施例4: Example 4:
一种宏块模式的快速选择方法的装置,如图1所示。该装置按照实施例1所述的模式选择方法实现,具体包括:整像素精度第一类帧间模式选择器,1/4像素精度运动估计器,帧内模式选择器,模式判决器,第二类帧间模式选择器。 A device for a fast selection method of a macroblock mode, as shown in FIG. 1 . The device is implemented according to the mode selection method described in Embodiment 1, and specifically includes: a first-type inter-frame mode selector with integer pixel precision, a motion estimator with 1/4 pixel precision, an intra-frame mode selector, a mode decider, and a second Class inter-mode selector. the
1)整像素精度第一类帧间模式选择器的输出端接1/4像素精度运动估计器,输出第一类帧间模式中最优的编码模式及该编码模式下宏块的编码代价。这里的第一类帧间模式指的是16×16,16×8,8×16,8×8宏块编码模式。 1) The output terminal of the first-type inter-frame mode selector with integer pixel precision is connected to a 1/4-pixel precision motion estimator, which outputs the optimal coding mode in the first-type inter-frame mode and the coding cost of the macroblock in this coding mode. The first type of inter-frame mode here refers to 16×16, 16×8, 8×16, 8×8 macroblock coding modes. the
2)1/4像素精度运动估计器的输入端接整像素精度第一类帧间模式选择器,输出端接模式判决器,输出对应的模式及1/4像素精度运动估计后该编码模式下宏块的编码代价。 2) The input terminal of the 1/4 pixel precision motion estimator is connected to the first type inter-frame mode selector with integer pixel precision, and the output terminal is connected to the mode decision device, which outputs the corresponding mode and the 1/4 pixel precision motion estimation in this encoding mode The coding cost of the macroblock. the
3)帧内模式选择器的输出端接模式判决器,输出五种帧内模式中最优的模式及该编码模式下宏块的编码代价。 3) The output terminal of the intra-frame mode selector is connected to the mode decision device, which outputs the optimal mode among the five intra-frame modes and the coding cost of the macroblock in this coding mode. the
4)第二类帧间模式选择器的输出端接模式判决器,输出第二类帧间模式中最优的编码模式及该编码模式下的宏块编码代价。这里的第二类帧间模式指的是SKIP模式和DIRECT模式。 4) The output terminal of the second-type inter-frame mode selector is connected to the mode decision device, which outputs the optimal coding mode in the second-type inter-frame mode and the macroblock coding cost in this coding mode. The second type of inter-frame mode here refers to SKIP mode and DIRECT mode. the
5)模式判决器的一个输入端接1/4像素精度运动估计器,一个输入端接帧内模式选择器,还有一个输入端接第二类帧间模式选择器,输出三个输入的模式中最优的模式。 5) One input terminal of the mode decision device is connected to the 1/4 pixel precision motion estimator, one input terminal is connected to the intra-frame mode selector, and one input terminal is connected to the second-type inter-frame mode selector, and three input modes are output the best mode in . the
实施例5: Embodiment 5:
一种宏块模式的快速选择方法的装置,如图2所示。该装置按照实施例2所述的模式选择方法实现,具体包括残差绝对值比较器,第一编码代价计算器,第二编码代价计算器,模式选择器。 A device for a fast selection method of a macroblock mode, as shown in FIG. 2 . The device is implemented according to the mode selection method described in Embodiment 2, and specifically includes a residual absolute value comparator, a first encoding cost calculator, a second encoding cost calculator, and a mode selector. the
1)残差绝对值比较器的输出端接模式选择器,输出残差绝对值SAD_Skip是否大于门限Th(QP)的信号。 1) The output terminal of the residual absolute value comparator is connected to the mode selector, and outputs a signal indicating whether the residual absolute value SAD_Skip is greater than the threshold Th(QP). the
2)第一编码代价计算器的输出端接模式选择器,输出除SKIP模式外其它模式中最优的模式及该模式下宏块的编码代价。 2) The output terminal of the first coding cost calculator is connected to the mode selector, and outputs the optimal mode among other modes except SKIP mode and the coding cost of the macroblock in this mode. the
3)第二编码代价计算器的输出端接模式选择器,输出SKIP模式的编码代价。 3) The output terminal of the second coding cost calculator is connected to the mode selector to output the coding cost of the SKIP mode. the
4)模式选择器的三个输入端分别接上面的三个模块,残差绝对值比较器,第一编码代价计算器,第二编码代价计算器。输出最终确定的编码模式。 4) The three input terminals of the mode selector are respectively connected to the above three modules, the residual absolute value comparator, the first encoding cost calculator, and the second encoding cost calculator. Output the finalized encoding mode. the
实施例6: Embodiment 6:
一种宏块模式的快速选择方法的装置,如图3所示。该装置按照实施例3所述的模式选择方法实现,具体包括:4倍整像素精度第一类帧间模式选择器,整像素精度运动估计器,帧内模式选择器,第一模式判决器,第二类帧间模式选择器,第二模式判决器,SKIP模式计算器。 A device for a fast selection method of a macroblock mode, as shown in FIG. 3 . The device is implemented according to the mode selection method described in Embodiment 3, and specifically includes: a first-type inter-frame mode selector with 4 times integer pixel precision, a motion estimator with integer pixel precision, an intra-frame mode selector, a first mode decision device, The second type inter-frame mode selector, the second mode decision unit, and the SKIP mode calculator. the
1)4倍整像素精度第一类帧间模式选择器的输出端接整像素精度运动估计器,输出第一类帧间编码模式中最优的编码模式及该编码模式下宏块的编码代价。这里的第一类帧间模式指的是16×16,16×8,8×16,8×8,8×4,4×8,4×4宏块编码模式。 1) The output terminal of the first-type inter-frame mode selector with 4 times integer pixel precision is connected to the integer-pixel precision motion estimator, and outputs the optimal coding mode in the first-type inter-frame coding mode and the coding cost of the macroblock in this coding mode . The first type of inter-frame mode here refers to 16×16, 16×8, 8×16, 8×8, 8×4, 4×8, and 4×4 macroblock coding modes. the
2)整像素精度运动估计器的输入端接部分4倍整像素精度第一类帧间模式选择器,输出端接第一模式判决器,输出对应的模式及高精度运动估计后该编码模式下宏块的编码代价。 2) The input terminal of the integer pixel precision motion estimator is connected to the first type inter-frame mode selector with 4 times the integer pixel precision, and the output terminal is connected to the first mode decision device, which outputs the corresponding mode and high-precision motion estimation in this coding mode The coding cost of the macroblock. the
3)帧内模式选择器的输出端接第一模式判决器,输出16×16和4×4帧内模式中最优的模式及该编码模式下宏块的编码代价。 3) The output terminal of the intra-frame mode selector is connected to the first mode decision device, which outputs the optimal mode among the 16×16 and 4×4 intra-frame modes and the coding cost of the macroblock in this coding mode. the
4)第二类帧间模式选择器的输出端接第一模式判决器,输出第二类帧间模式中最优的编码模式及该编码模式下的宏块编码代价。这里的第二类帧间模式指的是空间DIRECT模式和时间DIRECT模式。 4) The output terminal of the second-type inter-frame mode selector is connected to the first mode decision device, and outputs the optimal coding mode in the second-type inter-frame mode and the macroblock coding cost in this coding mode. The second type of inter-frame mode here refers to a spatial DIRECT mode and a temporal DIRECT mode. the
5)第一模式判决器的一个输入端接整像素精度运动估计器,一个输入端接帧内模式选择器,还有一个输入端接第二类帧间模式选择器,输出端接第二模式判决器,输出三个输入的模式中最优的模式及该编码模式下宏块的编码代价。 5) An input terminal of the first mode decision device is connected to an integer pixel precision motion estimator, an input terminal is connected to an intra-frame mode selector, an input terminal is connected to a second-type inter-frame mode selector, and an output terminal is connected to a second mode The decision unit outputs the optimal mode among the three input modes and the encoding cost of the macroblock in the encoding mode. the
6)SKIP模式计算器的输出端接第二模式判决器,输出SKIP模式及SKIP模式下的宏块编码代价。 6) The output terminal of the SKIP mode calculator is connected to the second mode decision device, and outputs the SKIP mode and the coding cost of the macroblock in the SKIP mode. the
7)第二模式判决器的一个输入端接第一模式判决器,另一个输入端接SKIP模式计算器,输出两个输入编码模式中较优的编码模式 7) One input terminal of the second mode decision device is connected to the first mode decision device, and the other input terminal is connected to the SKIP mode calculator, and the better coding mode among the two input coding modes is output
Claims (5)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010184776 CN101867818B (en) | 2008-06-06 | 2008-06-06 | Selection method and device of macroblock mode |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201010184776 CN101867818B (en) | 2008-06-06 | 2008-06-06 | Selection method and device of macroblock mode |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 200810062426 Division CN101304529A (en) | 2008-06-06 | 2008-06-06 | Method and device for selecting macroblock mode |
Publications (2)
Publication Number | Publication Date |
---|---|
CN101867818A CN101867818A (en) | 2010-10-20 |
CN101867818B true CN101867818B (en) | 2012-08-29 |
Family
ID=42959342
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 201010184776 Expired - Fee Related CN101867818B (en) | 2008-06-06 | 2008-06-06 | Selection method and device of macroblock mode |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101867818B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102065298B (en) * | 2011-01-05 | 2012-10-24 | 西安电子科技大学 | High-performance macroblock coding implementation method |
CN102811346B (en) * | 2011-05-31 | 2015-09-02 | 富士通株式会社 | coding mode selection method and system |
CN102404570B (en) * | 2011-11-16 | 2014-06-04 | 浙江工业大学 | Method for rapidly selecting multi-view video coding modes based on rate distortion sensitivity |
CN105812795B (en) * | 2014-12-31 | 2019-02-12 | 浙江大华技术股份有限公司 | A kind of determination method and apparatus of the coding mode of maximum coding unit |
CN109996074A (en) * | 2017-12-29 | 2019-07-09 | 富士通株式会社 | Picture coding device, picture decoding apparatus and electronic equipment |
CN113489997A (en) * | 2021-05-27 | 2021-10-08 | 杭州博雅鸿图视频技术有限公司 | Motion vector prediction method, motion vector prediction device, storage medium and terminal |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1810037A (en) * | 2003-06-25 | 2006-07-26 | 汤姆森许可贸易公司 | Fast mode-decision encoding for interframes |
CN101032173A (en) * | 2004-09-28 | 2007-09-05 | 索尼株式会社 | Encoder, encoding method, program of encoding method and recording medium wherein program of encoding method is recorded |
CN101068355A (en) * | 2007-06-05 | 2007-11-07 | 南京大学 | A Fast Conversion Method from MPEG-2 to H.264 |
CN101179728A (en) * | 2007-12-13 | 2008-05-14 | 北京中星微电子有限公司 | Method and apparatus for determining interframe encoding mode |
-
2008
- 2008-06-06 CN CN 201010184776 patent/CN101867818B/en not_active Expired - Fee Related
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1810037A (en) * | 2003-06-25 | 2006-07-26 | 汤姆森许可贸易公司 | Fast mode-decision encoding for interframes |
CN101032173A (en) * | 2004-09-28 | 2007-09-05 | 索尼株式会社 | Encoder, encoding method, program of encoding method and recording medium wherein program of encoding method is recorded |
CN101068355A (en) * | 2007-06-05 | 2007-11-07 | 南京大学 | A Fast Conversion Method from MPEG-2 to H.264 |
CN101179728A (en) * | 2007-12-13 | 2008-05-14 | 北京中星微电子有限公司 | Method and apparatus for determining interframe encoding mode |
Non-Patent Citations (1)
Title |
---|
JP特开2003-284091A 2003.10.03 |
Also Published As
Publication number | Publication date |
---|---|
CN101867818A (en) | 2010-10-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102984521B (en) | High-efficiency video coding inter-frame mode judging method based on temporal relativity | |
CN101964906B (en) | Rapid intra-frame prediction method and device based on texture characteristics | |
CN101304529A (en) | Method and device for selecting macroblock mode | |
CN103188496B (en) | Based on the method for coding quick movement estimation video of motion vector distribution prediction | |
CN101815218B (en) | Method for coding quick movement estimation video based on macro block characteristics | |
CN101815215B (en) | Method and apparatus for coding mode selection | |
CN103327325B (en) | The quick self-adapted system of selection of intra prediction mode based on HEVC standard | |
CN100401789C (en) | A Fast Selection Method of H.264/AVC Intra Prediction Mode | |
CN107087200B (en) | Skip coding mode advanced decision method for high-efficiency video coding standard | |
CN107147911A (en) | Method and device for fast inter-frame coding mode selection based on local brightness compensation LIC | |
CN102932642B (en) | Interframe coding quick mode selection method | |
CN100574447C (en) | Fast intraframe predicting mode selecting method based on the AVS video coding | |
CN103384325A (en) | Quick inter-frame prediction mode selection method for AVS-M video coding | |
CN101022555B (en) | Fast Mode Selection Method for Inter-Frame Predictive Coding | |
CN102186081B (en) | H.264 intra-frame mode selection method based on gradient vector | |
CN101867818B (en) | Selection method and device of macroblock mode | |
CN110351552B (en) | A Fast Coding Method in Video Coding | |
CN108366256A (en) | A kind of HEVC intra prediction modes quickly select system and method | |
CN104853191A (en) | HEVC fast coding method | |
CN102075751B (en) | Macro block motion state-based H264 quick mode selection method | |
CN103384327A (en) | AVS fast mode selection algorithm based on adaptive threshold | |
CN102647598A (en) | H.264 inter-frame mode optimization method based on maximum and minimum MV difference | |
CN110365975A (en) | A kind of AVS2 video encoding and decoding standard prioritization scheme | |
CN101883275B (en) | Video coding method | |
CN101072355B (en) | A Weighted Predictive Motion Compensation Method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20120829 |
|
CF01 | Termination of patent right due to non-payment of annual fee |