CN101227615A - image processing method - Google Patents
image processing method Download PDFInfo
- Publication number
- CN101227615A CN101227615A CN 200710003943 CN200710003943A CN101227615A CN 101227615 A CN101227615 A CN 101227615A CN 200710003943 CN200710003943 CN 200710003943 CN 200710003943 A CN200710003943 A CN 200710003943A CN 101227615 A CN101227615 A CN 101227615A
- Authority
- CN
- China
- Prior art keywords
- prediction
- block
- pixels
- prediction mode
- blocks
- 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.)
- Pending
Links
- 238000003672 processing method Methods 0.000 title claims abstract description 41
- 238000012545 processing Methods 0.000 claims abstract description 25
- 238000000034 method Methods 0.000 claims description 23
- 230000005540 biological transmission Effects 0.000 claims description 12
- 238000004364 calculation method Methods 0.000 description 10
- 238000010586 diagram Methods 0.000 description 10
- 241000023320 Luma <angiosperm> Species 0.000 description 9
- OSWPMRLSEDHDFF-UHFFFAOYSA-N methyl salicylate Chemical compound COC(=O)C1=CC=CC=C1O OSWPMRLSEDHDFF-UHFFFAOYSA-N 0.000 description 9
- 238000013139 quantization Methods 0.000 description 8
- 230000009466 transformation Effects 0.000 description 5
- 230000006835 compression Effects 0.000 description 2
- 238000007906 compression Methods 0.000 description 2
- 238000006243 chemical reaction Methods 0.000 description 1
- 239000011159 matrix material Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000008569 process Effects 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000004904 shortening Methods 0.000 description 1
- 230000002123 temporal effect Effects 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
Images
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
- Compression, Expansion, Code Conversion, And Decoders (AREA)
Abstract
一种图像处理方法,此方法是将图像框内预测模式中4*4区块预测模式的公式扩展应用到16*16区块中各个4*4区块或8*8区块的预测上,在一次操作(Pass)中就决定了16*16区块中各个4*4区块或是8*8区块的预测模式,或者是分为三次操作决定16*16区块中各个8*8区块的预测模式。如此即可省去逐个4*4区块判断预测模式的运算操作,有效降低进行4*4区块框内预测的处理时间,而达到增加图像处理效率的目的。
An image processing method is provided, which extends the formula of the 4*4 block prediction mode in the image frame prediction mode to the prediction of each 4*4 block or 8*8 block in the 16*16 block, and determines the prediction mode of each 4*4 block or 8*8 block in the 16*16 block in one operation (Pass), or determines the prediction mode of each 8*8 block in the 16*16 block in three operations. In this way, the operation of determining the prediction mode of each 4*4 block can be omitted, and the processing time of the 4*4 block frame prediction can be effectively reduced, so as to achieve the purpose of increasing the image processing efficiency.
Description
技术领域 technical field
本发明是有关于一种图像处理方法,且特别是有关于一种能够缩短预测模式判断时间,加快图像重建速度的图像处理方法。The present invention relates to an image processing method, and in particular relates to an image processing method capable of shortening the time for judging a prediction mode and accelerating the speed of image reconstruction.
背景技术 Background technique
H.264是由国际电信同盟(International Telecommunication Union-Telecommunication Standardization Sector,ITU-T)的视频编码专家群(Video Coding Expert Group,VCEG)与国际标准化组织(InternationalOrganization for Standardization,ISO)的运动图像专家组(MovingPictures Experts Group,MPEG)共同组成的联合视频小组所拟定的新一代的视频压缩标准,此技术在纳入MPEG-4的第10部分(ISO/IEC 14496-10)后则称为进阶视频解码(Advanced Video Coding,AVC),或合并称之H.264/AVC。相关研究数据显示,H.264/AVC相较于MPEG-2及MPEG-4,无论是在压缩率上或是视频质量上皆有大幅的提升,因此也被广泛用于视频会议、视频广播或视频串流服务等视频应用上。H.264 is developed by the Video Coding Expert Group (VCEG) of the International Telecommunication Union (International Telecommunication Union-Telecommunication Standardization Sector, ITU-T) and the motion picture expert group of the International Organization for Standardization (ISO). (Moving Pictures Experts Group, MPEG) is a new generation of video compression standard proposed by the Joint Video Group. This technology is called Advanced Video Decoding after it is included in
H.264在空间性及时间性的预测上比先前的H.263+等标准具有更佳的效能,它使用框内(Intra Frame)及框间(Inter Frame)编码重建的像素来预测内部的编码区块。其中,在使用框内预测技术来进行像素的预测时,为了增加编码效率,H.264利用了与邻近区块在空间域(Spatial domain)上的相关性来做预测,且在储存数据时只记录所预测的模式及实际的误差。邻近区块通常是指目前编码区块左方与上方的区块,这些区块的像素都已经被编码过,因此其记录的信息能再被利用。H.264 has better performance in spatial and temporal prediction than previous standards such as H.263+. It uses intra-frame (Intra Frame) and inter-frame (Inter Frame) encoded reconstructed pixels to predict internal code block. Among them, when using intra-frame prediction technology to predict pixels, in order to increase coding efficiency, H.264 uses the correlation with adjacent blocks in the spatial domain (Spatial domain) to make predictions, and only Record predicted patterns and actual errors. Adjacent blocks usually refer to the blocks to the left and above of the current coded block. The pixels of these blocks have been coded, so the recorded information can be reused.
以一个4×4区块的预测为例,图1所绘示为已知H.264的4×4区块的配置图,其中a~p代表区块中的像素、A~H代表此区块上方区块的边缘像素值、I~L则是代表左方区块的边缘像素值,H.264的预测模式就是利用这些边缘像素值来做预测。Taking the prediction of a 4×4 block as an example, Figure 1 shows the configuration diagram of a known H.264 4×4 block, where a~p represent the pixels in the block, and A~H represent the area The edge pixel values of the block above the block, and I~L represent the edge pixel values of the left block. The prediction mode of H.264 uses these edge pixel values for prediction.
框内预测技术依图像复杂度的不同,可分为4×4亮度(Luma)预测模式、16×16亮度(Luma)预测模式及8×8色度(Chroma)预测模式。其中,4×4亮度预测模式依其预测方向的不同又包括了9种不同的预测模式。图2及图3分别为已知H.264的4×4亮度预测模式所包括的9种预测模式的示意图及公式列表。请同时参照图2及图3,这些预测模式包括直流(DC)模式和其余8个方向的模式,而其公式依像素所在的位置可归纳为:The intra-frame prediction technology can be divided into 4×4 luma (Luma) prediction mode, 16×16 luma (Luma) prediction mode and 8×8 chroma (Chroma) prediction mode according to the image complexity. Among them, the 4×4 luma prediction mode includes 9 different prediction modes according to the different prediction directions. FIG. 2 and FIG. 3 are respectively a schematic diagram and a formula list of nine prediction modes included in the 4×4 luma prediction mode of the known H.264. Please refer to Figure 2 and Figure 3 at the same time. These prediction modes include direct current (DC) mode and the other 8 directions, and the formula can be summarized as follows according to the position of the pixel:
其中i∈区块L,K,J,I,M,A,B,C,D,E,F,G,H,举例来说,若是选择模式0(即垂直模式),则可以下列公式来预测位于第x行第y列的像素(y,x)的像素值:Wherein i∈ block L, K, J, I, M, A, B, C, D, E, F, G, H, for example, if mode 0 (ie vertical mode) is selected, the following formula can be used to Predict the pixel value of the pixel (y, x) at row x, column y:
像素(0,0)、(1,0)、(2,0)、(3,0)是由A来预测;Pixels (0, 0), (1, 0), (2, 0), (3, 0) are predicted by A;
像素(0,1)、(1,1)、(2,1)、(3,1)是由B来预测;Pixels (0, 1), (1, 1), (2, 1), (3, 1) are predicted by B;
像素(0,2)、(1,2)、(2,2)、(3,2)是由C来预测;Pixels (0, 2), (1, 2), (2, 2), (3, 2) are predicted by C;
像素(0,3)、(1,3)、(2,3)、(3,3)是由D来预测。Pixels (0, 3), (1, 3), (2, 3), (3, 3) are predicted by D.
此外,若是选择模式3(即对角线左下模式),则是以下列公式来预测像素值:In addition, if
像素(0,0)是由(A+2B+C+2)/4来预测;Pixel (0, 0) is predicted by (A+2B+C+2)/4;
像素(0,1)、(1,0)是由(B+2C+D+2)/4来预测;Pixels (0, 1), (1, 0) are predicted by (B+2C+D+2)/4;
像素(0,2)、(1,1)、(2,0)是由(C+2D+E+2)/4来预测;Pixels (0, 2), (1, 1), (2, 0) are predicted by (C+2D+E+2)/4;
像素(0,3)、(1,2)、(2,1)、(3,0)是由(D+2E+F+2)/4来预测;Pixels (0, 3), (1, 2), (2, 1), (3, 0) are predicted by (D+2E+F+2)/4;
像素(1,3)、(2,2)、(3,1)是由(E+2F+G+2)/4来预测;Pixels (1, 3), (2, 2), (3, 1) are predicted by (E+2F+G+2)/4;
像素(2,3)、(3,2)是由(F+2G+H+2)/4来预测;Pixels (2, 3), (3, 2) are predicted by (F+2G+H+2)/4;
像素(3,3)是由(G+3H+2)/4来预测。Pixel (3,3) is predicted by (G+3H+2)/4.
4×4亮度预测模式即是以4×4的子区块(Sub-block)为单位,并利用上述9种预测模式找寻其参考对象(Predictor),而将其与参考对象相减后,取得差余(Residual)图像。最后再将此差余图像以及所使用的预测模式进行转换后,即可获得此4×4子区块的图像编码。The 4×4 luma prediction mode is based on the 4×4 sub-block (Sub-block), and uses the above nine prediction modes to find its reference object (Predictor), and subtracts it from the reference object to obtain Residual image. Finally, after converting the residual image and the used prediction mode, the image coding of the 4×4 sub-block can be obtained.
然而,H.264在执行图像编码时,实际上是以16×16的区块为单位进行编码,而一个16×16区块又再细分为4×4子区块来进行预测。采用这样的方式,在解码一个4×4子区块时,必须参考其左方及上方区块的重建值,因此在解码这些4×4子区块时,必须按照一定的顺序,逐个(由上往下,由左往右)4×4子区块来进行,此举虽然可获得较为精确的预测效果,但所占用的运算资源及所花费的计算时间则会相对地增加,无法满足现今讲求效率的要求。However, when H.264 performs image coding, it actually codes in units of 16×16 blocks, and a 16×16 block is subdivided into 4×4 sub-blocks for prediction. In this way, when decoding a 4×4 sub-block, it is necessary to refer to the reconstruction values of the left and upper blocks, so when decoding these 4×4 sub-blocks, one by one (by From top to bottom, from left to right) 4×4 sub-blocks, although this can obtain more accurate prediction results, but the occupied computing resources and computing time will be relatively increased, which cannot meet the current requirements. Emphasis on efficiency requirements.
发明内容 Contents of the invention
有鉴于此,本发明提供一种图像处理方法,通过在一次操作(Pass)中找出16*16区块中各个4*4区块的预测模式,而能够增加图像处理的效率。In view of this, the present invention provides an image processing method, which can increase the efficiency of image processing by finding the prediction mode of each 4*4 blocks in the 16*16 blocks in one pass.
本发明提供一种图像处理方法,通过在一次操作中找出16*16区块中各个8*8区块的预测模式,而能够增加图像处理的效率。The present invention provides an image processing method, which can increase the efficiency of image processing by finding out the prediction mode of each 8*8 blocks in the 16*16 blocks in one operation.
本发明提供一种图像处理方法,以8*8区块为单位,逐次找出16*16区块中各个8*8区块的预测模式,而能够增加图像处理的效率。The present invention provides an image processing method, which uses 8*8 blocks as a unit to successively find out the prediction modes of each 8*8 blocks in 16*16 blocks, so as to increase the efficiency of image processing.
本发明提出一种图像处理方法,适用于一个可区分为多个预测区块的图像,此方法包括下列步骤:a.计算这些预测区块像素在多个预测模式下与对应的图像边界像素间的差值平方和;b.根据a步骤结果,决定预测区块像素重建时所使用的预测模式;以及c.根据b步骤结果,重建这些预测区块的像素。The present invention proposes an image processing method, which is suitable for an image that can be divided into multiple prediction blocks. The method includes the following steps: a. Calculate the distance between the pixels of these prediction blocks and the corresponding image boundary pixels in multiple prediction modes b. According to the result of step a, determine the prediction mode used for pixel reconstruction of the prediction block; and c. Reconstruct the pixels of these prediction blocks according to the result of step b.
在本发明的一实施例中,其中在a步骤之后还包括:a1.利用a步骤结果,计算各个预测区块像素在各个预测模式下的剩余值;以及a2.根据a步骤以及a1步骤结果,决定预测区块像素重建时所使用的预测模式。In an embodiment of the present invention, after step a, it further includes: a1. Using the result of step a, calculating the residual value of each prediction block pixel in each prediction mode; and a2. According to the result of step a and step a1, Determines the prediction mode used when predicting block pixel reconstruction.
在本发明的一实施例中,上述的图像为16*16像素所组成的区块,而预测区块为4*4区块。In an embodiment of the present invention, the above image is a block composed of 16*16 pixels, and the prediction block is a 4*4 block.
在本发明的一实施例中,上述的方法包括垂直预测模式、水平预测模式、直流预测模式、对角下左预测模式、对角下右预测模式、垂直向右预测模式、水平向下预测模式、垂直向左预测模式,以及水平向上预测模式等9种预测模式。In an embodiment of the present invention, the above method includes vertical prediction mode, horizontal prediction mode, DC prediction mode, diagonal lower left prediction mode, diagonal lower right prediction mode, vertical rightward prediction mode, and horizontal downward prediction mode , vertical left prediction mode, and horizontal upward prediction mode and other 9 prediction modes.
在本发明的一实施例中,其中a2步骤还包括:a2-1.根据a1步骤结果,决定这些预测区块像素在这些预测模式下所对应的位传输率;a2-2.根据a步骤以及a2-1步骤结果,计算欲些预测区块像素的位传输率-失真最佳值;以及a2-3.根据a2-2步骤结果,决定这些预测区块像素重建时所使用的预测模式。In an embodiment of the present invention, step a2 further includes: a2-1. According to the result of step a1, determine the bit transmission rate corresponding to the prediction block pixels in these prediction modes; a2-2. According to step a and The result of step a2-1, calculating the optimal bit rate-distortion value of the pixels in the prediction block; and a2-3. According to the result of step a2-2, determining the prediction mode used when the pixels of the prediction block are reconstructed.
在本发明的一实施例中,其中a2-1步骤中为利用这些预测区块像素在这些预测模式下的剩余值经离散余弦转换、量化,以及熵运算后,以决定这些预测区块像素在这些预测模式下所对应的位传输率。In an embodiment of the present invention, the a2-1 step is to use the residual values of these prediction block pixels in these prediction modes after discrete cosine transform, quantization, and entropy operation to determine the prediction block pixels in The corresponding bit rates for these predictive modes.
在本发明的一实施例中,上述的预设的16个预测区块由上而下、由左而右依序区分为a~p位置的预测区块,则c步骤中各个预测区块的重建顺序为:a→b、e→c、f、i→d、g、j、m→h、k、n→l、o→p。In an embodiment of the present invention, the above-mentioned 16 preset prediction blocks are sequentially divided into prediction blocks at positions a to p from top to bottom, and from left to right, then the prediction blocks of each prediction block in step c The reconstruction sequence is: a→b, e→c, f, i→d, g, j, m→h, k, n→l, o→p.
本发明提出一种图像处理方法,适用于可区分为多个预测区块的图像,此方法包括下列步骤:a.将这些预测区块区分为多个区域,其中每一个区域具有至少两个预测区块;b.先针对这些区域中的其一,计算此区域内各个预测区块像素在多个预测模式下与对应的图像边界像素间的差值平方和;c.根据b步骤结果,决定此区域内预测区块像素重建时所使用的预测模式;d.根据c步骤结果,重建此区域内各个预测区块的像素;以及e.根据d步骤结果,利用区域边界的已重建像素,重建与此区域相邻的区域内的预测区块的像素。The present invention proposes an image processing method, which is suitable for images that can be divided into multiple prediction blocks. The method includes the following steps: a. Divide these prediction blocks into multiple regions, wherein each region has at least two prediction block; b. first for one of these areas, calculate the sum of squares of the difference between each prediction block pixel in this area and the corresponding image boundary pixel in multiple prediction modes; c. according to the result of step b, determine The prediction mode used when reconstructing the pixels of the prediction block in this area; d. according to the result of step c, reconstruct the pixels of each prediction block in this area; and e. according to the result of step d, use the reconstructed pixels on the boundary of the area to reconstruct Pixels of predicted blocks in the region adjacent to this region.
在本发明的一实施例中,其中b步骤之后还包括:b1.利用b步骤结果,计算此区域内各个预测区块像素在这些预测模式下的剩余值;以及b2.根据b步骤及b1步骤结果,决定此区域内预测区块像素重建时所使用的预测模式。In an embodiment of the present invention, after step b, it further includes: b1. Using the result of step b, calculate the residual value of each prediction block pixel in this area under these prediction modes; and b2. According to step b and step b1 As a result, the prediction mode used for pixel reconstruction of the prediction block in this region is determined.
在本发明的一实施例中,上述的图像为16*16像素所组成的区块,预测区块为4*4区块,而上述的区域则为8*8区块。In an embodiment of the present invention, the above-mentioned image is a block composed of 16*16 pixels, the prediction block is a 4*4 block, and the above-mentioned area is an 8*8 block.
在本发明的一实施例中,其中b2步骤还包括:b2-1.根据b1步骤结果,决定此区域内各个预测区块像素在这些预测模式下所对应的位传输率;b2-2.根据b步骤以及b2-1步骤结果,计算此区域内各个预测区块像素的位传输率-失真最佳值;以及b2-3.根据b2-2步骤结果,决定此区域内各个预测区块像素重建时所使用的预测模式。In an embodiment of the present invention, step b2 further includes: b2-1. According to the result of step b1, determine the bit transmission rate corresponding to each prediction block pixel in this area under these prediction modes; b2-2. According to Step b and the result of step b2-1, calculate the optimal bit rate-distortion value of each prediction block pixel in this area; and b2-3. According to the result of step b2-2, determine the reconstruction of each prediction block pixel in this area The prediction mode used when .
在本发明的一实施例中,其中预设的4个预测区块由上而下、由左而右依序区分为a、b、e以及f位置的预测区块,则e步骤中这些预测区块的重建顺序为:a→b、e→f。In an embodiment of the present invention, the four preset prediction blocks are sequentially divided into prediction blocks at positions a, b, e and f from top to bottom and from left to right, then these prediction blocks in step e The reconstruction order of blocks is: a→b, e→f.
在本发明的一实施例中,其中e步骤还包括:e1.计算至少一个相邻区域内各个预测区块像素在多个预测模式下与对应的区域边界的已重建像素间的差值平方和;e2.利用e1步骤结果,计算此相邻区域内各个预测区块像素在这些预测模式下的剩余值;e3.根据e1步骤以及e2步骤结果,决定此相邻区域内预测区块像素重建时所使用的预测模式;以及e4.根据e3步骤结果,重建此相邻区域内各个预测区块的像素。此外,上述的e1~e4步骤为对两个相邻区域像素进行重建。In an embodiment of the present invention, step e further includes: e1. Calculating the sum of squared differences between each prediction block pixel in at least one adjacent region and the reconstructed pixel of the corresponding region boundary under multiple prediction modes ; e2. Using the result of step e1, calculate the residual value of each prediction block pixel in the adjacent area under these prediction modes; e3. According to the results of step e1 and step e2, determine when the pixels of the prediction block in the adjacent area are reconstructed The prediction mode used; and e4. Reconstructing the pixels of each prediction block in the adjacent area according to the result of step e3. In addition, the above-mentioned steps e1-e4 are to reconstruct pixels in two adjacent regions.
本发明提出一种图像处理方法,适用于可区分为多个预测区块的图像,此方法包括下列步骤:a.将这些预测区块区分为多个区域,其中每一个区域具有至少两个预测区块;b.计算每一个区域内各个预测区块像素在多个预测模式下与对应的图像边界像素间的差值平方和;c.根据b步骤结果,决定每一个区域内预测区块像素重建时所使用的预测模式;以及d.根据c步骤结果,重建每一个区域内各个预测区块的像素。The present invention proposes an image processing method, which is suitable for images that can be divided into multiple prediction blocks. The method includes the following steps: a. Divide these prediction blocks into multiple regions, wherein each region has at least two prediction block; b. calculate the sum of the squares of the difference between each prediction block pixel in each region and the corresponding image boundary pixel in multiple prediction modes; c. determine the prediction block pixel in each region according to the result of step b The prediction mode used during reconstruction; and d. Reconstructing the pixels of each prediction block in each region according to the result of step c.
在本发明的一实施例中,其中b步骤之后还包括:b1.利用b步骤结果,计算每一个区域内各个预测区块像素在这些预测模式下的剩余值;以及b2.根据b步骤以及b1步骤结果,决定每一个区域内预测区块像素重建时所使用的预测模式。In an embodiment of the present invention, after step b, it further includes: b1. Using the result of step b, calculate the residual value of each prediction block pixel in each region under these prediction modes; and b2. According to step b and b1 As a result of the step, the prediction mode used for pixel reconstruction of the prediction block in each region is determined.
在本发明的一实施例中,上述的图像为16*16像素所组成的区块,预测区块为4*4区块,而上述的区域为8*8区块。In an embodiment of the present invention, the above-mentioned image is a block composed of 16*16 pixels, the prediction block is a 4*4 block, and the above-mentioned area is an 8*8 block.
在本发明的一实施例中,其中b2步骤还包括:b2-1.根据b-1步骤结果,决定每一个区域内各个预测区块像素在这些预测模式下所对应的位传输率;b2-2.根据b步骤以及b2-1步骤结果,计算每一个区域内各个预测区块像素的位传输率-失真最佳值;以及b2-3.根据b2-2步骤结果,决定每一个区域内各个预测区块像素重建时所使用的预测模式。In an embodiment of the present invention, step b2 further includes: b2-1. According to the result of step b-1, determine the corresponding bit transmission rate of each prediction block pixel in each region under these prediction modes; b2- 2. According to the results of step b and step b2-1, calculate the optimal bit rate-distortion value of each prediction block pixel in each region; and b2-3. According to the result of step b2-2, determine the optimal The prediction mode used when predicting block pixel reconstruction.
在本发明的一实施例中,上述的预设的4个区域由上而下、由左而右依序区分为I、II、III以及IV位置的4区域,则e步骤中各个预测区块的重建顺序为:I→II、III→IV。In an embodiment of the present invention, the above-mentioned four preset areas are sequentially divided into four areas of positions I, II, III and IV from top to bottom and from left to right, then each prediction block in step e The order of reconstruction is: I→II, III→IV.
本发明因采用将4*4区块预测模式的公式扩展应用到16*16区块中各个4*4区块或8*8区块的预测上,省去逐个4*4区块计算及判断预测模式所耗费的计算时间及运算资源,因此可以增加图像处理的效率。In the present invention, the formula of the 4*4 block prediction mode is extended and applied to the prediction of each 4*4 block or 8*8 block in the 16*16 block, which saves the calculation and judgment of each 4*4 block The calculation time and computing resources consumed by the prediction mode can increase the efficiency of image processing.
为让本发明的上述和其它目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附图式,作详细说明如下。In order to make the above and other objects, features and advantages of the present invention more comprehensible, preferred embodiments will be described in detail below together with the accompanying drawings.
附图说明 Description of drawings
图1所绘示为已知H.264的4×4区块的配置图。FIG. 1 is a configuration diagram of a known H.264 4×4 block.
图2为已知H.264的4×4亮度预测模式所包括的9种预测模式的示意图。FIG. 2 is a schematic diagram of nine prediction modes included in the known 4×4 luma prediction mode of H.264.
图3(a)-(b)为已知H.264的4×4亮度预测模式所包括的9种预测模式的公式列表。Fig. 3(a)-(b) is a formula list of 9 prediction modes included in the 4×4 luma prediction mode of known H.264.
图4是依照本发明第一实施例所绘示的图像处理方法流程图。FIG. 4 is a flowchart of an image processing method according to the first embodiment of the present invention.
图5是依照本发明第一实施例所绘示的H.264框内预测算法的预测模式3的示意图。FIG. 5 is a schematic diagram of
图6是依照本发明第一实施例所绘示的差值平方和计算方法流程图。FIG. 6 is a flowchart of a method for calculating the sum of squares of differences according to the first embodiment of the present invention.
图7依照本发明第一实施例所绘示的9种不同预测模式下的差值平方和。FIG. 7 shows the difference sum of squares in nine different prediction modes according to the first embodiment of the present invention.
图8(a)-(b)是依照本发明第一实施例所绘示的图像处理方法的一范例。8(a)-(b) are an example of an image processing method according to the first embodiment of the present invention.
图9(a)-(f)是依照本发明第一实施例所绘示的重建像素的一范例。9(a)-(f) are an example of reconstructed pixels according to the first embodiment of the present invention.
图10是依照本发明第二实施例所绘示的图像处理方法流程图。FIG. 10 is a flowchart of an image processing method according to a second embodiment of the present invention.
图11是依照本发明第二实施例所绘示的9种不同预测模式下的差值平方和。FIG. 11 is the difference sum of squares in 9 different prediction modes according to the second embodiment of the present invention.
图12(a)-(b)是依照本发明第二实施例所绘示的图像处理的示意图。12(a)-(b) are schematic diagrams of image processing according to the second embodiment of the present invention.
图13是依照本发明第三实施例所绘示的图像处理方法流程图。FIG. 13 is a flowchart of an image processing method according to a third embodiment of the present invention.
图14是依照本发明第三实施例所绘示的9种不同预测模式下的差值平方和。FIG. 14 is the difference sum of squares in 9 different prediction modes according to the third embodiment of the present invention.
图15(a)-(f)是依照本发明第三实施例所绘示的图像处理方法的示意图。15(a)-(f) are schematic diagrams of an image processing method according to a third embodiment of the present invention.
[主要元件标号说明][Description of main component labels]
a~p、A1~A4、B1~B4、C1~C4、D1~D4、E1~E4、F1~F4、G1~G4、H1~H4、I1~I4、J1~J4、K1~K4、L1~L4:像素a~p, A1~A4, B1~B4, C1~C4, D1~D4, E1~E4, F1~F4, G1~G4, H1~H4, I1~I4, J1~J4, K1~K4, L1~ L4: Pixels
A~H、I~L、M、I、II、III、IV:区块A~H, I~L, M, I, II, III, IV: blocks
Ra1~Ra16、Rb1~Rb16、Rc1~Rc16、Rd1~Rd16、a’~p’:重建值Ra1~Ra16, Rb1~Rb16, Rc1~Rc16, Rd1~Rd16, a'~p': reconstruction value
S410~S430:本发明第一实施例的图像处理方法的各步骤S410-S430: each step of the image processing method in the first embodiment of the present invention
S411~S415:本发明第一实施例的差值平方和计算方法的各步骤S411-S415: each step of the method for calculating the sum of squared differences in the first embodiment of the present invention
S1010~S1040:本发明第二实施例的图像处理方法的各步骤S1010-S1040: each step of the image processing method of the second embodiment of the present invention
S1310~S1328:本发明第三实施例的图像处理方法的各步骤S1310-S1328: each step of the image processing method of the third embodiment of the present invention
具体实施方式 Detailed ways
图像框内预测必须参考目前区块上方及左方区块的边缘像素值,才能计算像素的预测值和找出最适合的预测模式,这样的特性让图像处理算法在进行预测时,一次只能处理一个区块。针对此点,本发明将原本小区块的预测公式扩大应用到大区块上,仅利用一次操作(pass)找出此大区块中各个小区块或包括数个小区块的区域适用的预测模式。藉此及早算出各个区块的边缘像素值,而能够同时进行多个区块预测值的计算,增加图像处理的效率。为了使本发明的内容更为明了,以下特举实施例作为本发明确实能够据以实施的范例。In-frame prediction must refer to the edge pixel values of the block above and to the left of the current block in order to calculate the predicted value of the pixel and find out the most suitable prediction mode. This feature allows the image processing algorithm to predict only one time Process a block. Aiming at this point, the present invention expands the prediction formula of the original small block and applies it to the large block, and only uses one operation (pass) to find out the prediction mode applicable to each small block in the large block or an area including several small blocks . In this way, the edge pixel values of each block can be calculated early, and the prediction values of multiple blocks can be calculated simultaneously, thereby increasing the efficiency of image processing. In order to make the content of the present invention clearer, the following specific examples are given as examples in which the present invention can actually be implemented.
第一实施例first embodiment
图4是依照本发明第一实施例所绘示的图像处理方法流程图。请参照图4,本实施例适用于一个可区分为多个4*4区块的图像,此图像中的一个16*16区块包括16个4*4区块,而各个4*4区块则包括16个像素。其中,本实施例将原本4*4区块的预测公式扩大应用到16*16区块上,在一次操作中就找出16*16区块中各个4*4区块的预测模式,而能够增加图像处理的效率。FIG. 4 is a flowchart of an image processing method according to the first embodiment of the present invention. Please refer to Fig. 4, this embodiment is applicable to an image that can be divided into multiple 4*4 blocks, a 16*16 block in this image includes 16 4*4 blocks, and each 4*4
详细地说,原本框内预测算法的9种预测模式(如图2及图3所示)将扩展应用到16*16区块上。举例来说,图5是依照本发明第一实施例所绘示的图像框内预测算法的预测模式3(即对角下左模式)的示意图。请同时参照图2及图5,本实施例的预测模式3与已知的预测模式3相类似,其参考像素值的方向均是往左下方45度的方向,惟本实施例将原本4*4区块的预测进一步扩展到16*16区块的预测,其对应的预测公式亦延伸至16*16区块的大小。举例来说,像素(0,0)是由(A1+2A2+A3+2)/4来预测;像素(0,1)、(1,0)是由(A2+2A3+A4+2)/4来预测;像素(0,2)、(1,1)、(2,0)是由(A3+2A4+B1+2)/4来预测,以此类推。In detail, the nine prediction modes of the original intra-frame prediction algorithm (as shown in FIG. 2 and FIG. 3 ) will be extended and applied to 16*16 blocks. For example, FIG. 5 is a schematic diagram of the prediction mode 3 (ie, the diagonal bottom left mode) of the image intra-frame prediction algorithm according to the first embodiment of the present invention. Please refer to FIG. 2 and FIG. 5 at the same time. The
本实施例即以上述的手法扩展9种预测模式的公式,计算这些4*4区块像素在各个预测模式下与对应的图像边界像素间的差值平方和(步骤S410)。其中,上述的图像边界像素例如是一个行/列矩阵像素。此外,上述步骤可再细分为多个子步骤。图6是依照本发明第一实施例所绘示的差值平方和计算方法流程图。请参照图6,首先使用上述预测模式的公式,以计算16*16区块中所有像素对应9种预测公式的预测值(步骤S411)。In this embodiment, the above method is used to extend the formulas of the nine prediction modes, and calculate the sum of squares of differences between the pixels of these 4*4 blocks in each prediction mode and the corresponding image boundary pixels (step S410 ). Wherein, the aforementioned image boundary pixel is, for example, a row/column matrix pixel. In addition, the above steps can be subdivided into a plurality of sub-steps. FIG. 6 is a flowchart of a method for calculating the sum of squares of differences according to the first embodiment of the present invention. Please refer to FIG. 6 , first use the formulas of the above prediction modes to calculate the prediction values of all pixels in the 16*16 block corresponding to the 9 prediction formulas (step S411 ).
接着则以4*4区块为单位,将各个4*4区块像素的预测值与其原始值相减,而获得这些4*4区块像素的差余值(Residual)(步骤S412)。这些差余值在经过离散余弦转换(Discrete Cosine Trans formation,DCT)、量化(Quantization,Q)、反量化(Inverse Quantization,IQ)及反离散余弦转换(Inverse Discrete Cosine Trans forma tion,IDCT)等转换步骤后,即会转变为转换值(步骤S413)。这些转换值则被加上预测值,而得到模式预测值(步骤S414)。最后,再将各个4*4区块像素的模式预测值与原始值的差值取平方后相加,就可获得如图7所绘示的9种不同预测模式下的差值平方和(步骤S415),此差值平方和的计算公式如下:Then, taking the 4*4 block as a unit, the predicted value of each 4*4 block pixel is subtracted from its original value to obtain the residual value (Residual) of these 4*4 block pixels (step S412 ). These residual values are transformed by discrete cosine transformation (Discrete Cosine Transformation, DCT), quantization (Quantization, Q), inverse quantization (Inverse Quantization, IQ) and inverse discrete cosine transformation (Inverse Discrete Cosine Transformation, IDCT), etc. After the step, it will be transformed into a converted value (step S413). These conversion values are added to the prediction value to obtain the mode prediction value (step S414). Finally, the difference between the model prediction value and the original value of each 4*4 block pixel is squared and added to obtain the sum of squares of the difference in 9 different prediction modes as shown in Figure 7 (step S415), the calculation formula of this difference sum of squares is as follows:
其中,x代表区块的行数,而y代表区块的列数,根据这些预测模式所算出的差值平方和,即可找出各个4*4区块最适合的预测模式(步骤S420)。详细地说,本实施例是分别针对各个4*4区块,在其利用上述9种预测模式所算出的9笔差值平方和中,挑选出最小值,而选择具有最小值的预测模式做为此4*4区块最适合的预测模式。举例来说,图8是依照本发明第一实施例所绘示的图像处理方法的一范例。如图8(a)所示,区块a所选择的预测模式为第8模式、区块b所选择的预测模式为第0模式,以此类推。以上步骤均在一个操作(Pass)完成,因此可省去逐个区块找寻预测模式所耗费的时间。Wherein, x represents the number of rows of the block, and y represents the number of columns of the block. According to the sum of squared differences calculated by these prediction modes, the most suitable prediction mode for each 4*4 block can be found (step S420) . Specifically, in this embodiment, for each 4*4 block, the minimum value is selected from the 9 difference sums of squares calculated by using the above 9 prediction modes, and the prediction mode with the minimum value is selected to make The most suitable prediction mode for this 4*4 block. For example, FIG. 8 is an example of an image processing method according to the first embodiment of the present invention. As shown in FIG. 8( a ), the prediction mode selected by block a is the 8th mode, the prediction mode selected by block b is the 0th mode, and so on. The above steps are all completed in one operation (Pass), so the time spent in finding the prediction mode block by block can be saved.
值得一提的是,上述计算差值平方和以判断预测模式的方式是采用框内预测算法的简单模式。然而,若是使用复杂模式时,则必须把位传输率的因素考虑进来。其中,此位传输率可通过计算各个4*4区块像素在各个预测模式下的剩余值(如图8(b)所示),并经由离散余弦转换、量化,以及熵(entropy)运算后,取得各个4*4区块像素在各个预测模式下所对应的位传输率。接着,将此位传输率加上原本的差值平方和后,即可获得位传输率-失真最佳值(Rate-distortion optimization,RDO)。据此,找出RDO最小值所对应的预测模式做为各个4*4区块像素重建时所使用的预测模式。此处所得到的预测模式因为加入位传输率的因素,因此会比先前利用差至平方和所得到的预测模式来得更为准确。It is worth mentioning that the above method of calculating the sum of squared differences to determine the prediction mode is a simple mode of using the intra-frame prediction algorithm. However, when complex mode is used, the bit rate must be taken into consideration. Among them, the bit transmission rate can be calculated by calculating the residual value of each 4*4 block pixel in each prediction mode (as shown in Figure 8(b)), and after discrete cosine transform, quantization, and entropy (entropy) operation , to obtain the bit transmission rate corresponding to each 4*4 block pixel in each prediction mode. Then, after adding the bit transmission rate to the original sum of squares of the differences, the optimal value of the bit transmission rate-distortion (Rate-distortion optimization, RDO) can be obtained. Accordingly, the prediction mode corresponding to the minimum value of RDO is found out as the prediction mode used for pixel reconstruction of each 4*4 block. The prediction model obtained here is more accurate than the previous prediction model obtained by using the difference to the sum of squares because of the factor of the bit rate.
在各个4*4区块的预测模式决定后,在另一个操作(Pass)中,就可以利用这些决定的预测模式,并基于图像边界像素,重建这些4*4区块的像素。(步骤S430),而当所有4*4区块的像素的重建值都计算完后,就完成16*16区块像素的重建步骤。其中,本实施例在进行像素重建时是将一个16*16区块划分为16个4*4区块,这些4*4区块由上而下、由左而右依序编号为a~p(如图5所示),而这些4*4区块的重建顺序为:a→b、e→c、f、i→d、g、j、m→h、k、n→l、o→p。After the prediction mode of each 4*4 block is determined, in another operation (Pass), the determined prediction mode can be used to reconstruct the pixels of these 4*4 blocks based on the image boundary pixels. (Step S430 ), and when the reconstruction values of the pixels in all 4*4 blocks are calculated, the reconstruction step of the pixels in the 16*16 block is completed. Wherein, in this embodiment, a 16*16 block is divided into 16 4*4 blocks during pixel reconstruction, and these 4*4 blocks are sequentially numbered as a~p from top to bottom and from left to right (As shown in Figure 5), and the reconstruction sequence of these 4*4 blocks is: a→b, e→c, f, i→d, g, j, m→h, k, n→l, o→ p.
在一实施例中,为了加速上述像素重建的步骤,本实施例还包括在进行一个4*4区块的重建时,先利用预测公式算出此4*4区块的边缘像素,并进一步提供给其相邻的4*4区块作为预测之用,采用此做法即能够在重建一个4*4区块的同时,也进行下一个相邻4*4区块像素的重建工作,而大幅降低像素重建所需的时间。In one embodiment, in order to speed up the above-mentioned steps of pixel reconstruction, this embodiment also includes that when reconstructing a 4*4 block, first calculate the edge pixels of the 4*4 block by using a prediction formula, and further provide the Its adjacent 4*4 blocks are used for prediction. With this method, while rebuilding a 4*4 block, the reconstruction of the pixels of the next adjacent 4*4 block can be carried out, and the pixels can be greatly reduced. The time required to rebuild.
为了帮助理解,以下则举实施例说明上述重建像素的详细步骤,而为了方便说明,在此仅以重建4个4*4区块a、b、e、f(即图5左上角的4个4*4区块)为例。图9是依照本发明第一实施例所绘示的重建像素的一范例。请参照图9,本实施例首先利用4*4区块a所对应的预测模式的预测公式,计算图9(a)中4*4区块a中像素的预测值,而这些预测值在加上原本在步骤S412算出的差余值后,即可获得4*4区块a的像素的重建值。In order to help understanding, the following examples are given to illustrate the detailed steps of the above-mentioned reconstruction pixels, and for the convenience of description, only four 4*4 blocks a, b, e, f (that is, the four blocks in the upper left corner of Figure 5) are reconstructed here. 4*4 blocks) as an example. FIG. 9 is an example of reconstructed pixels according to the first embodiment of the present invention. Please refer to FIG. 9. In this embodiment, first, the prediction formula of the prediction mode corresponding to the 4*4 block a is used to calculate the predicted values of the pixels in the 4*4 block a in FIG. 9(a), and these predicted values are added After adding the residual value originally calculated in step S412, the reconstructed value of the pixel in the 4*4 block a can be obtained.
值得一提的是,在上述的步骤中,可先利用预测公式计算出4*4区块a右缘及下缘等7个像素的预测值,而先提供给右边及下面的4*4区块b、e及早开始进行重建工作,如此即可省去等待4*4区块a重建的时间,而加快整体图像重建的速度。举例来说,如图9(b)所示,4*4区块a的预测模式为垂直向下,因此可先预测出4*4区块a下缘及右缘的像素。It is worth mentioning that in the above steps, the predicted values of the 7 pixels including the right edge and the lower edge of the 4*4 block a can be calculated by using the prediction formula, and provided to the right and lower 4*4 areas first Blocks b and e start reconstruction work early, so that the time of waiting for the reconstruction of 4*4 block a can be saved, and the overall image reconstruction speed can be accelerated. For example, as shown in FIG. 9( b ), the prediction mode of the 4*4 block a is vertically downward, so the pixels at the bottom and right edges of the 4*4 block a can be predicted first.
而在取得4*4区块a右缘及下缘像素的预测值后,即可进一步计算4*4区块b、e像素的预测值,并在加入差余值后,取得该4*4区块b、e像素的重建值。其中,由于在计算4*4区块e像素时,可能需要用到4*4区块b下缘的像素来进行预测,因此在上述步骤中则可先利用预测公式计算出4*4区块b下缘的4个像素的预测值,而先提供给4*4区块e及早开始进行重建工作,如此即可省去等待4*4区块b重建的时间,而加快整体图像重建的速度。After obtaining the predicted values of the right edge and lower edge pixels of the 4*4 block a, the predicted values of the pixels of the 4*4 block b and e can be further calculated, and after adding the difference value, the 4*4 Reconstructed values of pixels in blocks b and e. Among them, since the pixels at the lower edge of the 4*4 block b may need to be used for prediction when calculating the e pixels of the 4*4 block, so in the above steps, the prediction formula can be used to calculate the 4*4 block The prediction value of the 4 pixels at the lower edge of b is first provided to the 4*4 block e to start the reconstruction work early, so that the time of waiting for the reconstruction of the 4*4 block b can be saved, and the speed of the overall image reconstruction can be accelerated .
举例来说,如图9(c)所示,4*4区块b的预测模式为水平向右,因此可先预测出4*4区块b下缘的像素,而在此同时也进行4*4区块a像素的重建值Ra1~Ra16的计算。而在取得4*4区块b下缘的像素后,则可用来计算4*4区块e像素的预测值,而为了能够及早提供4*4区块f进行预测,因此可先计算4*4区块e右缘的像素。举例来说,如图9(d)所示,4*4区块e的预测模式为垂直下左模式,因此可利用4*4区块b下缘的像素先预测出4*4区块e右缘的像素,而获得预测值e4、e8、e12、e16。其中,这些预测值的计算公式是如图3所示,故在此不再赘述。当然,在预测这些预测值的同时也可开始计算4*4区块b像素的重建值Rb1~Rb16。For example, as shown in Figure 9(c), the prediction mode of the 4*4 block b is horizontal to the right, so the pixels at the lower edge of the 4*4 block b can be predicted first, and the 4*4 block b is also predicted at the same time. *4 Calculation of reconstruction values Ra1-Ra16 of pixels in block a. After obtaining the pixels at the lower edge of the 4*4 block b, it can be used to calculate the predicted value of the 4*4 block e pixel. In order to provide the 4*4 block f for prediction as early as possible, the 4*4 block f can be calculated first. 4 Pixels on the right edge of block e. For example, as shown in Figure 9(d), the prediction mode of the 4*4 block e is the vertical bottom left mode, so the pixels at the lower edge of the 4*4 block b can be used to first predict the 4*4 block e The pixels on the right edge are used to obtain predicted values e4, e8, e12, and e16. Wherein, the calculation formulas of these predicted values are as shown in FIG. 3 , so they will not be repeated here. Of course, the reconstruction values Rb1-Rb16 of pixels in the 4*4 block b can also be calculated while predicting these predicted values.
在取得4*4区块b下缘及4*4区块e右缘像素的预测值后,即可进一步计算4*4区块f像素的预测值,并在加入差余值后,取得4*4区块f像素的重建值。如图9(e)所示,4*4区块f的预测模式为水平向右模式,因此即可利用4*4区块e的右缘像素的预测值计算4*4区块f像素的预测值。而在进行4*4区块f的预测时,同时也可开始计算4*4区块e像素的重建值Re1~Re16。最后,如图9(f)所示,待取得4*4区块f的预测值后,再加上差余值,即可获得4*4区块f的重建值Rf1~Rf16。After obtaining the predicted value of the lower edge of the 4*4 block b and the right edge pixel of the 4*4 block e, the predicted value of the f pixel of the 4*4 block can be further calculated, and after adding the difference value, 4 *4 Reconstructed value of pixel in block f. As shown in Figure 9(e), the prediction mode of the 4*4 block f is the horizontal right mode, so the predicted value of the right edge pixel of the 4*4 block e can be used to calculate the pixel value of the 4*4 block f Predictive value. When the prediction of the 4*4 block f is performed, the reconstruction values Re1˜Re16 of the pixels of the 4*4 block e can also be calculated at the same time. Finally, as shown in FIG. 9( f ), after obtaining the predicted value of the 4*4 block f and adding the residual value, the reconstructed values Rf1˜Rf16 of the 4*4 block f can be obtained.
本实施例在一次操作中就决定了16*16区块中各个4*4区块的预测模式,让原本必须对16个4*4区块分别计算9种预测模式的运算简化到只需对1个16*16区块计算9种预测模式,这也代表本实施例可有效降低进行4*4区块框内预测的处理时间,而达到增加图像处理效率的目的。In this embodiment, the prediction mode of each 4*4 block in the 16*16 block is determined in one operation, so that the calculation of 9 prediction modes for the 16 4*4 blocks is simplified to only need to Nine prediction modes are calculated for one 16*16 block, which also means that this embodiment can effectively reduce the processing time for intra-frame prediction of 4*4 blocks, thereby achieving the purpose of increasing image processing efficiency.
第二实施例second embodiment
图10是依照本发明第二实施例所绘示的图像处理方法流程图。请参照图10,本实施例适用于一个可区分为多个4*4区块的图像。首先,将这些4*4区块区分为多个(例如是4个)区域,其中每一个区域具有至少两个4*4区块(步骤S1010),以下仅以包括四个4*4区块的区域(即8*8区块)为例。也就是说,一个16*16区块包括4个8*8区块,各个8*8区块则包括4个4*4区块,而各个4*4区块则包括了16个像素。其中,本实施例将原本4*4区块的预测公式扩大应用到16*16区块上,在一次操作(Pass)中就找出16*16区块中各个8*8区块的预测模式,而能够增加图像处理的效率。FIG. 10 is a flowchart of an image processing method according to a second embodiment of the present invention. Please refer to FIG. 10 , this embodiment is applicable to an image that can be divided into multiple 4*4 blocks. First, these 4*4 blocks are divided into multiple (for example, 4) areas, each of which has at least two 4*4 blocks (step S1010), and only four 4*4 blocks are included below The area (that is, 8*8 blocks) is taken as an example. That is to say, a 16*16 block includes four 8*8 blocks, each 8*8 block includes four 4*4 blocks, and each 4*4 block includes 16 pixels. Among them, in this embodiment, the prediction formula of the original 4*4 block is expanded and applied to the 16*16 block, and the prediction mode of each 8*8 block in the 16*16 block is found in one operation (Pass). , which can increase the efficiency of image processing.
本实施例以类似第一实施例的手法,先计算每一个8*8区块内各个4*4区块像素在多个预测模式下与对应的图像边界像素间的差值平方和(步骤S1020)。其中,此差值平方和的计算公式与前述第一实施例相似,故相同的作法在此不再赘述,唯一不同的是本实施例在最后计算差值平方和时是以8*8区块为单位,将各个8*8区块像素的模式预测值与原始值的差值取平方后相加,而获得如图11所绘示的9种不同预测模式下的差值平方和。In this embodiment, similar to the method of the first embodiment, first calculate the sum of squares of the differences between the pixels of each 4*4 block in each 8*8 block and the corresponding image boundary pixels in multiple prediction modes (step S1020 ). Wherein, the calculation formula of the difference sum of squares is similar to that of the aforementioned first embodiment, so the same method will not be repeated here. The only difference is that this embodiment uses 8*8 block As a unit, the difference between the mode prediction value and the original value of each 8*8 block pixel is squared and added to obtain the sum of the squares of the differences under 9 different prediction modes as shown in FIG. 11 .
而根据这些预测模式所算出的差值平方和,即可找出各个8*8区块最适合的预测模式(步骤S1030)。详细地说,本实施例是分别针对各个8*8区块,在其利用上述9种预测模式所算出的9笔差值平方和中,挑选出最小值,而选择具有最小值的预测模式做为此8*8区块最适合的预测模式。举例来说,图12是依照本发明第二实施例所绘示的图像处理的示意图。如图12(a)所示,区块I所选择的预测模式为第4模式、区块II所选择的预测模式为第2模式,以此类推。以上步骤均在一个操作(Pass)完成,因此可省去逐个区块找寻预测模式所耗费的时间。According to the sum of squared differences calculated by these prediction modes, the most suitable prediction mode for each 8*8 block can be found (step S1030 ). Specifically, in this embodiment, for each 8*8 block, the minimum value is selected from the 9 difference sums of squares calculated by using the above 9 prediction modes, and the prediction mode with the minimum value is selected to make The most suitable prediction mode for this 8*8 block. For example, FIG. 12 is a schematic diagram of image processing according to the second embodiment of the present invention. As shown in FIG. 12( a ), the prediction mode selected by block I is the fourth mode, the prediction mode selected by block II is the second mode, and so on. The above steps are all completed in one operation (Pass), so the time spent in finding the prediction mode block by block can be saved.
同样地,在本实施例中,亦可将位传输率的因素考虑进来。其中,此位传输率可通过计算各个8*8区块像素在各个预测模式下的剩余值(如图12(b)所示),并经由离散余弦转换、量化、以及熵运算后,取得各个8*8区块像素在各个预测模式下所对应的位传输率。接着,将此位传输率加上原本的差值平方和后,即可获得位传输率-失真最佳值(RDO)。据此,找出RDO最小值所对应的预测模式做为各个8*8区块像素重建时所使用的预测模式。此处所得到的预测模式因为加入位传输率的因素,因此会比先前利用差至平方和所得到的预测模式来得更为准确。Likewise, in this embodiment, the factor of the bit transmission rate can also be taken into consideration. Among them, the bit transmission rate can be obtained by calculating the residual value of each 8*8 block pixel in each prediction mode (as shown in Figure 12(b)), and after discrete cosine transform, quantization, and entropy operation, each 8*8 block pixels correspond to bit transfer rates in each prediction mode. Then, the bit rate-distortion optimal value (RDO) can be obtained by adding the bit rate to the original sum of squared differences. Accordingly, the prediction mode corresponding to the minimum value of RDO is found out as the prediction mode used for pixel reconstruction of each 8*8 block. The prediction model obtained here is more accurate than the previous prediction model obtained by using the difference to the sum of squares because of the factor of the bit rate.
在各个8*8区块的预测模式决定后,就可以利用这些决定的预测模式,并基于图像边界像素,重建这些8*8区块的像素(步骤S1040),而当所有8*8区块的像素的重建值都计算完后,就完成16*16区块像素的重建步骤。其中,本实施例在进行像素重建时是将一个16*16区块划分为4个8*8区块,这些8*8区块由上而下、由左而右依序编号为I、II、III以及IV(如图12(a)所示)等4个区域,而这些8*8区块的重建顺序为:I→II、III→IV。After the prediction modes of each 8*8 blocks are determined, these determined prediction modes can be used to reconstruct the pixels of these 8*8 blocks based on the image boundary pixels (step S1040), and when all 8*8 blocks After all the reconstruction values of the pixels in the are calculated, the reconstruction step of the pixels in the 16*16 block is completed. Wherein, the present embodiment divides a 16*16 block into four 8*8 blocks when performing pixel reconstruction, and these 8*8 blocks are numbered as I and II from top to bottom and from left to right , III, and IV (as shown in FIG. 12( a )), and the reconstruction order of these 8*8 blocks is: I→II, III→IV.
在一实施例中,为了加速上述像素重建的步骤,本实施例还包括在进行一个8*8区块的重建时,先利用预测公式算出此8*8区块的边缘像素,并进一步提供给其相邻的8*8区块作为预测之用,采用此做法即能够在重建一个8*8区块的同时,也进行下一个相邻8*8区块像素的重建工作,而大幅降低像素重建所需的时间。其中,一边进行预测且一边进行重建的部分是与第一实施例所述相同或相似,故在此不再赘述。In one embodiment, in order to speed up the above-mentioned steps of pixel reconstruction, this embodiment also includes that when reconstructing an 8*8 block, first calculate the edge pixels of the 8*8 block by using a prediction formula, and further provide the Its adjacent 8*8 blocks are used for prediction. By using this method, one 8*8 block can be reconstructed, and the pixels of the next adjacent 8*8 block can be reconstructed, which greatly reduces the number of pixels. The time required to rebuild. Wherein, the part performing prediction and reconstruction at the same time is the same or similar to that described in the first embodiment, so it will not be repeated here.
本实施例在一次操作中就决定了16*16区块中各个8*8区块的预测模式,让原本必须对4个8*8区块分别计算9种预测模式的运算简化到只需对1个16*16区块计算9种预测模式,这也代表本实施例可有效降低进行8*8区块框内预测的处理时间,而达到增加图像处理效率的目的。In this embodiment, the prediction mode of each 8*8 block in the 16*16 block is determined in one operation, so that the calculation of 9 prediction modes for the 4 8*8 blocks is simplified to only need to Nine prediction modes are calculated for one 16*16 block, which also means that this embodiment can effectively reduce the processing time for intra-frame prediction of 8*8 blocks, thereby achieving the purpose of increasing image processing efficiency.
第三实施例third embodiment
图13是依照本发明第三实施例所绘示的图像处理方法流程图。请参照图13,本实施例适用于一个可区分为多个4*4区块的图像。首先,将这些个4*4区块区分为多个(例如是4个)区域,其中每一个区域具有至少两个4*4区块(步骤S1310)。以下仅以包括四个4*4区块的区域(即8*8区块)为例。也就是说,一个16*16区块包括左上、右上、左下及右下等4个8*8区块,各个8*8区块则包括4个4*4区块,而各个4*4区块则包括了16个像素。其中,本实施例将原本4*4区块的预测公式扩大应用到16*16区块上,并利用在三次操作(Pass)找出16*16区块中各个8*8区块的预测模式,而能够增加图像处理的效率。FIG. 13 is a flowchart of an image processing method according to a third embodiment of the present invention. Please refer to FIG. 13 , this embodiment is applicable to an image that can be divided into multiple 4*4 blocks. First, the 4*4 blocks are divided into multiple (for example, 4) regions, each of which has at least two 4*4 blocks (step S1310 ). The following only takes an area including four 4*4 blocks (ie, 8*8 blocks) as an example. That is to say, a 16*16 block includes four 8*8 blocks such as upper left, upper right, lower left, and lower right, each 8*8 block includes four 4*4 blocks, and each 4*4 area A block consists of 16 pixels. Among them, in this embodiment, the prediction formula of the original 4*4 block is expanded and applied to the 16*16 block, and the prediction mode of each 8*8 block in the 16*16 block is found by using three operations (Pass). , which can increase the efficiency of image processing.
本实施例同样以类似第一实施例的手法,将原本框内预测算法的9种预测模式扩展到16*16区块上。然而,与前述实施例不同的是,本实施例仅先针对这些8*8区块其中之一(例如左上角8*8区块),计算此8*8区块内4个4*4区块像素在多个预测模式下与对应的图像边界像素间的差值平方和(步骤S1312),所获得的9种不同预测模式下的差值平方和则如图14所示。此差值平方和的计算方法与前述实施例相同或相似,故在此不再赘述。In this embodiment, similar to the method of the first embodiment, the nine prediction modes of the original intra-frame prediction algorithm are extended to 16*16 blocks. However, different from the foregoing embodiments, this embodiment only first calculates four 4*4 regions in the 8*8 block for one of these 8*8 blocks (for example, the 8*8 block in the upper left corner) The sum of squares of the difference between the block pixel and the corresponding image boundary pixel in multiple prediction modes (step S1312 ), the obtained sum of squares of the difference in 9 different prediction modes is shown in FIG. 14 . The method for calculating the sum of squared differences is the same as or similar to that of the foregoing embodiment, so it will not be repeated here.
而根据这些预测模式所算出的差值平方和,即可找出此左上8*8区块中各个4*4区块最适合的预测模式(步骤S1314)。详细地说,本实施例是分别针对各个4*4区块,在其利用上述9种预测模式所算出的9笔差值平方和中,挑选出最小值,而选择具有最小值的预测模式做为此4*4区块最适合的预测模式。举例来说,图15是依照本发明第三实施例所绘示的图像处理方法的示意图。如图15(a)所示,区块a所选择的预测模式为第2模式、区块b所选择的预测模式为第7模式,以此类推。According to the sum of squared differences calculated by these prediction modes, the most suitable prediction mode for each 4*4 block in the upper left 8*8 blocks can be found (step S1314 ). Specifically, in this embodiment, for each 4*4 block, the minimum value is selected from the 9 difference sums of squares calculated by using the above 9 prediction modes, and the prediction mode with the minimum value is selected to make The most suitable prediction mode for this 4*4 block. For example, FIG. 15 is a schematic diagram of an image processing method according to a third embodiment of the present invention. As shown in FIG. 15( a ), the prediction mode selected by block a is the second mode, the prediction mode selected by block b is the seventh mode, and so on.
在各个4*4区块的预测模式决定后,就可以利用这些决定的预测模式,并基于图像边界像素,重建左上8*8区块中各个4*4区块像素,而当所有4*4区块像素的重建值都计算完后,就完成左上8*8区块像素的重建步骤(步骤S1316)。以上这些步骤均可在一次操作(Pass)之内完成,因此可以节省逐次计算4*4区块的预测模式及重建值所耗费的时间及运算资源。After the prediction mode of each 4*4 block is determined, these determined prediction modes can be used to reconstruct the pixels of each 4*4 block in the upper left 8*8 block based on the image boundary pixels, and when all 4*4 After the reconstruction values of the block pixels are all calculated, the reconstruction step of the upper left 8*8 block pixels is completed (step S1316 ). The above-mentioned steps can be completed within one operation (pass), so the time and computing resources consumed by sequentially calculating the prediction mode and reconstruction value of the 4*4 blocks can be saved.
请参照图15(b),其中4*4区块a、b、c、d的重建值均已计算完成,而获得重建值矩阵a’、b’、c’及d’。在一实施例中,上述计算重建值的步骤可再分为两个子步骤,其中包括先利用各个4*4区块所对应预测模式的预测公式,计算4*4区块像素的预测值。这些预测值则被拿来与差余值相加,而获得重建值。Please refer to FIG. 15(b), in which the reconstruction values of the 4*4 blocks a, b, c, and d have been calculated, and the reconstruction value matrices a', b', c', and d' are obtained. In one embodiment, the above step of calculating the reconstruction value can be further divided into two sub-steps, including firstly calculating the prediction value of the pixels in the 4*4 block by using the prediction formula of the prediction mode corresponding to each 4*4 block. These predicted values are then added to the residual values to obtain reconstructed values.
在取得左上8*8区块像素的重建值后,即代表右上8*8区块的左方区块的像素与左下区块的上方区块的像素为已知。因此,本实施例的下一个操作即是再采用上述9种预测模式的公式计算右上及左下8*8区块内各个4*4区块像素在多个预测模式下与对应的区域边界的已重建像素间的差值平方和(步骤S1318),而根据预测模式所算出的差值平方和,决定右上及左下8*8区块像素重建时所使用的预测模式(步骤S1320)。最后,利用决定的预测模式,并基于图像边界像素,重建右上及左下8*8区块像素(步骤S1322)。请参照图15(c),其中4*4区块c、d、g、h及4*4区块i、j、m、n的差值平方和及预测模式均已决定,而图15(d)则绘示原本4*4区块g、h及4*4区块j、n的重建值均已计算完成,而获得重建值矩阵g’、h’、j’及n’。After obtaining the reconstructed values of the pixels in the upper left 8*8 block, it means that the pixels in the left block of the upper right 8*8 block and the pixels in the upper block of the lower left block are known. Therefore, the next operation of this embodiment is to use the formulas of the above nine prediction modes to calculate the distance between each 4*4 block pixel in the upper right and lower left 8*8 blocks and the corresponding area boundary in multiple prediction modes. Reconstruct the sum of squared differences between pixels (step S1318), and determine the prediction mode used when reconstructing the upper right and lower left 8*8 block pixels according to the calculated sum of squared differences in the prediction mode (step S1320). Finally, the upper right and lower left 8*8 block pixels are reconstructed based on the determined prediction mode and based on the boundary pixels of the image (step S1322 ). Please refer to FIG. 15(c), where the difference sum of squares and prediction mode of 4*4 blocks c, d, g, h and 4*4 blocks i, j, m, n have been determined, and FIG. 15( d) shows that the reconstruction values of the original 4*4 blocks g, h and 4*4 blocks j, n have been calculated, and the reconstruction value matrices g', h', j', and n' are obtained.
值得一提的是,在以预测公式取得右上8*8区块及左下8*8区块中像素的预测值后,即代表右下8*8区块的上方区块与左方区块的像素为已知。因此,本实施例的下一个操作(Pass)即是采用上述9种预测模式的公式计算右下8*8区块内各个4*4区块像素在多个预测模式下与对应的区域边界的已重建像素间的差值平方和(步骤S1324),而根据预测模式所算出的差值平方和,决定右下8*8区块像素重建时所使用的预测模式(步骤S1326)(如图15(e)所示)。最后,利用决定的预测模式,并基于图像边界像素,重建右下8*8区块像素(步骤S1328)。至此,16*16区块中各个8*8区块的像素的重建值(如图15(f)所示)均已取得,而完成整个16*16区块像素的重建工作。It is worth mentioning that after obtaining the predicted values of the pixels in the upper right 8*8 block and the lower left 8*8 block by the prediction formula, it represents the upper block and the left block of the lower right 8*8 block. pixels are known. Therefore, the next operation (Pass) of this embodiment is to use the formulas of the above nine prediction modes to calculate the distance between each 4*4 block pixel in the lower right 8*8 block and the corresponding area boundary in multiple prediction modes. The sum of squared differences between the reconstructed pixels (step S1324), and the sum of squared differences calculated according to the prediction mode determines the prediction mode used for reconstruction of the lower right 8*8 block pixels (step S1326) (as shown in Figure 15 (e)). Finally, reconstruct the lower right 8*8 block pixels based on the determined prediction mode and based on the boundary pixels of the image (step S1328 ). So far, the reconstructed values of the pixels of each 8*8 block in the 16*16 block (as shown in FIG. 15( f )) have been obtained, and the reconstruction of the pixels of the entire 16*16 block is completed.
本实施例在三次操作(Pass)中决定了16*16区块中各个8*8区块的预测模式,让原本必须对16个4*4区块分别计算9种预测模式的运算简化到只需对4个8*8区块计算9种预测模式,这也代表本实施例可有效降低进行4*4区块框内预测的处理时间,而达到增加图像处理效率的目的。In this embodiment, the prediction mode of each 8*8 block in the 16*16 block is determined in three operations (Pass), so that the calculation of 9 prediction modes for the 16 4*4 blocks is simplified to only Nine prediction modes need to be calculated for four 8*8 blocks, which also means that this embodiment can effectively reduce the processing time for intra-frame prediction of 4*4 blocks, thereby achieving the purpose of increasing image processing efficiency.
综上所述,在本发明的图像处理方法至少具有下列优点:In summary, the image processing method of the present invention has at least the following advantages:
1.在一次操作中就决定了16*16区块中各个4*4区块或8*8区块的预测模式,不用逐个4*4区块或8*8区块地进行预测,因此可以节省运算时间,增加图像处理效率。1. The prediction mode of each 4*4 block or 8*8 block in the 16*16 block is determined in one operation, and there is no need to predict each 4*4 block or 8*8 block one by one, so it can Save computing time and increase image processing efficiency.
2.在三次操作中分别决定了16*16区块中左上8*8区块、右上及左下8*8区块,以及右下8*8区块的预测模式,而不用逐个4*4区块地进行预测,因此可以节省运算时间,增加图像处理效率。2. The prediction modes of the upper left 8*8 block, the upper right and lower left 8*8 blocks, and the lower right 8*8 block of the 16*16 blocks are determined in three operations, instead of 4*4 blocks one by one Prediction is done in blocks, so it can save computing time and increase image processing efficiency.
3.在一个区块的预测模式决定后、进行其它区块的预测的同时,即可对该区块进行后续的离散余弦转换、量化、熵计算等步骤,不必等到所有区块都预测完毕后才进行,因此可以节省运算时间,增加图像处理效率。3. After the prediction mode of a block is determined, the subsequent steps of discrete cosine transformation, quantization, and entropy calculation can be performed on the block while predicting other blocks, without waiting until all blocks are predicted Therefore, it can save computing time and increase image processing efficiency.
虽然本发明已以较佳实施例揭露如上,然其并非用以限定本发明,任何本领域技术人员,在不脱离本发明的精神和范围内,当可作些许的更动与润饰,因此本发明的保护范围当视所附的权利要求范围所界定者为准。Although the present invention has been disclosed above with preferred embodiments, it is not intended to limit the present invention. Any person skilled in the art may make some changes and modifications without departing from the spirit and scope of the present invention. Therefore, this The scope of protection of the invention should be defined by the appended claims.
Claims (20)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200710003943 CN101227615A (en) | 2007-01-19 | 2007-01-19 | image processing method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 200710003943 CN101227615A (en) | 2007-01-19 | 2007-01-19 | image processing method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN101227615A true CN101227615A (en) | 2008-07-23 |
Family
ID=39859334
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 200710003943 Pending CN101227615A (en) | 2007-01-19 | 2007-01-19 | image processing method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN101227615A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105828084A (en) * | 2016-03-30 | 2016-08-03 | 腾讯科技(深圳)有限公司 | HEVC inter-frame encoding processing method and device |
CN113406076A (en) * | 2018-07-05 | 2021-09-17 | 深圳辉煌耀强科技有限公司 | Smear image acquisition and analysis system |
-
2007
- 2007-01-19 CN CN 200710003943 patent/CN101227615A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105828084A (en) * | 2016-03-30 | 2016-08-03 | 腾讯科技(深圳)有限公司 | HEVC inter-frame encoding processing method and device |
CN113406076A (en) * | 2018-07-05 | 2021-09-17 | 深圳辉煌耀强科技有限公司 | Smear image acquisition and analysis system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN100534194C (en) | Method and device for video intra-frame predictive encoding and decoding | |
CN100586187C (en) | Method and device for intra-image predictive encoding/decoding | |
KR101457418B1 (en) | Method and apparatus for video coding according to the size of a hierarchical coding unit, video decoding method and apparatus thereof | |
CN113507603B (en) | Image signal encoding/decoding method and device thereof | |
CN101783957B (en) | A video predictive coding method and device | |
KR20110018189A (en) | Image encoding method and apparatus, decoding method and apparatus thereof | |
JP5795525B2 (en) | Image encoding method, image decoding method, image encoding device, image decoding device, image encoding program, and image decoding program | |
KR100739714B1 (en) | Method and apparatus for determining intra prediction mode | |
KR20110018188A (en) | Image encoding method and apparatus, image decoding method and apparatus | |
TW200952499A (en) | Apparatus and method for computationally efficient intra prediction in a video coder | |
KR20130085392A (en) | Method and apparatus for encoding and decoding video to enhance intra prediction process speed | |
US20070133689A1 (en) | Low-cost motion estimation apparatus and method thereof | |
CN112106372B (en) | Method and apparatus for hybrid intra prediction | |
KR101989160B1 (en) | Method and apparatus for image encoding | |
CN101227615A (en) | image processing method | |
CN118590660A (en) | Method and device for encoding/decoding image signal | |
KR101607613B1 (en) | Method and apparatus for image encoding, and method and apparatus for image decoding | |
KR101926017B1 (en) | Method and apparatus for video encoding and decoding dependent on hierarchical structure of coding unit | |
KR20080065898A (en) | Image processing method | |
KR101761278B1 (en) | Method and apparatus for image decoding | |
KR20150045980A (en) | Method and apparatus for image encoding, and method and apparatus for image decoding | |
KR101607614B1 (en) | Method and apparatus for image encoding, and method and apparatus for image decoding | |
KR101662742B1 (en) | Method and apparatus for video encoding and decoding dependent on hierarchical structure of coding unit | |
KR101687283B1 (en) | Method and apparatus for video encoding and decoding dependent on hierarchical structure of coding unit | |
KR101538921B1 (en) | Method and apparatus for video encoding and decoding dependent on hierarchical structure of coding unit |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C02 | Deemed withdrawal of patent application after publication (patent law 2001) | ||
WD01 | Invention patent application deemed withdrawn after publication |
Open date: 20080723 |