TWI869992B - Video encoder and video encoding method - Google Patents
Video encoder and video encoding method Download PDFInfo
- Publication number
- TWI869992B TWI869992B TW112131979A TW112131979A TWI869992B TW I869992 B TWI869992 B TW I869992B TW 112131979 A TW112131979 A TW 112131979A TW 112131979 A TW112131979 A TW 112131979A TW I869992 B TWI869992 B TW I869992B
- Authority
- TW
- Taiwan
- Prior art keywords
- coding block
- sub
- block
- coding
- prediction
- Prior art date
Links
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
Description
本發明是關於視訊編碼,尤其是關於視訊編碼器與視訊編碼方法。 The present invention relates to video coding, and more particularly to a video codec and a video coding method.
在視訊編碼的領域中,快速(fast)位元率-失真最佳化(Rate-distortion optimization,RDO)演算法及完整位元率-失真最佳化(full RDO)演算法常用於模式預測(mode prediction)。完整位元率-失真最佳化對應的是常規的實際/標準(real/standard),是指按照拉格朗日(Lagrange)的位元率-失真成本(RD cost)評價方法(如下面方程式(1)所示):J=arg min(D+λR) (1) In the field of video coding, fast rate-distortion optimization (RDO) and full rate-distortion optimization (full RDO) are commonly used for mode prediction. Full RDO corresponds to the conventional real/standard, which refers to the Lagrange rate-distortion cost (RD cost) evaluation method (as shown in the following equation (1)): J = arg min ( D + λR ) (1)
其中,J為某個模式的位元率-失真成本;D為該模式所對應的失真(distortion);R為該模式所對應的位元率成本(rate cost),包含模式語法成本(Mode syntax cost)和係數語法成本(coefficient Syntax cost);λ為當前量化參數所對應的係數。 Among them, J is the rate-distortion cost of a certain mode; D is the distortion corresponding to the mode; R is the rate cost corresponding to the mode, including the mode syntax cost and the coefficient syntax cost; λ is the coefficient corresponding to the current quantization parameter.
完整位元率-失真最佳化對各候選模式皆進行方程式(1)的計算,並選擇最小J所對應的模式作為最佳模式。然而,這相當耗費硬體資源及時間。 The complete rate-distortion optimization calculates equation (1) for each candidate mode and selects the mode corresponding to the minimum J as the best mode. However, this consumes a lot of hardware resources and time.
快速位元率-失真最佳化是根據方程式(2)進行計算。因為R'只包含模式語法成本但不包含係數語法成本,所以可以大幅節省硬體資源及時間。 Fast rate-distortion optimization is calculated according to equation (2). Because R' only includes the pattern syntax cost but not the coefficient syntax cost, it can significantly save hardware resources and time.
J=arg min(D+λR') (2) J = arg min ( D + λR' ) (2)
然而,如果快速位元率-失真最佳化是基於原始像素進行運算,而非基於重建(reconstructed)像素進行運算,則準確度不高。重建像素是指原始像素經過預測(prediction)、殘差計算(residual calculation)、變換(transformation)、量化(quantization)、逆量化(inverse quantization)、逆變換(inverse transformation)及重建(reconstructing)(有時還包含濾波)的結果。 However, if fast rate-distortion optimization is performed on original pixels rather than reconstructed pixels, the accuracy is not high. Reconstructed pixels are the result of prediction, residual calculation, transformation, quantization, inverse quantization, inverse transformation, and reconstruction (sometimes including filtering) of original pixels.
因此,需要一種視訊編碼器及方法來提升速度及準確度。 Therefore, a video encoder and method are needed to improve speed and accuracy.
鑑於先前技術之不足,本發明之一目的在於提供一種視訊編碼器與視訊編碼方法,以改善先前技術的不足。 In view of the shortcomings of the prior art, one purpose of the present invention is to provide a video encoder and a video encoding method to improve the shortcomings of the prior art.
本發明之一實施例提供一種視訊編碼器,該視訊編碼器包含一預測電路、一計算電路以及一編碼電路。預測電路被配置以:對一第一子編碼區塊執行一第一最佳化操作,以根據一基礎預測模式選擇該第一子編碼區塊的一相鄰塊的原始像素或重建像素的其中之一來產生該第一子編碼區塊的一中間預測模式;對該第一子編碼區塊執行一第二最佳化操作,以根據該中間預測模式、該第一子編碼區塊的原始像素及該第一子編碼區塊的該相鄰塊的重建像素決定一預測模式;以及,根據該第一子編碼區塊的原始像素、該第一子編碼區 塊的該相鄰塊的重建像素及該預測模式產生該第一子編碼區塊的一預測資訊,該預測資訊包括預測像素和原始像素與該預測像素之間的殘差值。計算電路耦接該預測電路,用來根據該第一子編碼區塊的該預測資訊產生該第一子編碼區塊的一編碼係數及重建像素。編碼電路耦接該預測電路及該計算電路,用來根據該編碼係數及該預測資訊產生一碼流。 An embodiment of the present invention provides a video encoder, which includes a prediction circuit, a calculation circuit and a coding circuit. The prediction circuit is configured to: perform a first optimization operation on a first sub-coding block to select one of original pixels or reconstructed pixels of a neighboring block of the first sub-coding block according to a basic prediction mode to generate an intermediate prediction mode of the first sub-coding block; perform a second optimization operation on the first sub-coding block to determine a prediction mode according to the intermediate prediction mode, the original pixels of the first sub-coding block and the reconstructed pixels of the neighboring block of the first sub-coding block; and generate prediction information of the first sub-coding block according to the original pixels of the first sub-coding block, the reconstructed pixels of the neighboring block of the first sub-coding block and the prediction mode, the prediction information comprising prediction pixels and residual values between the original pixels and the prediction pixels. The calculation circuit is coupled to the prediction circuit, and is used to generate a coding coefficient and reconstructed pixel of the first sub-coding block according to the prediction information of the first sub-coding block. The coding circuit is coupled to the prediction circuit and the calculation circuit, and is used to generate a code stream according to the coding coefficient and the prediction information.
本發明之另一實施例提供一種視訊編碼方法,包含:對一第一子編碼區塊執行一第一最佳化操作,以根據一基礎預測模式選擇該第一子編碼區塊的一相鄰塊的原始像素或重建像素的其中之一來產生該第一子編碼區塊的一中間預測模式;對該第一子編碼區塊執行一第二最佳化操作,以根據該中間預測模式、該第一子編碼區塊的原始像素及該第一子編碼區塊的該相鄰塊的重建像素決定一預測模式;根據該第一子編碼區塊的原始像素、該第一子編碼區塊的該相鄰塊的重建像素及該預測模式產生該第一子編碼區塊的一預測資訊,該預測資訊包括預測像素和原始像素與該預測像素之間的殘差值;根據該第一子編碼區塊的該預測資訊產生該第一子編碼區塊的一編碼係數及重建像素;以及,根據該編碼係數及該預測資訊產生一碼流。 Another embodiment of the present invention provides a video encoding method, comprising: performing a first optimization operation on a first sub-coding block to select one of original pixels or reconstructed pixels of a neighboring block of the first sub-coding block according to a basic prediction mode to generate an intermediate prediction mode of the first sub-coding block; performing a second optimization operation on the first sub-coding block to select one of original pixels or reconstructed pixels of a neighboring block of the first sub-coding block according to the intermediate prediction mode, the original pixels of the first sub-coding block and the neighboring block of the first sub-coding block. A prediction mode is determined based on the reconstructed pixels of the first sub-coding block; prediction information of the first sub-coding block is generated based on the original pixels of the first sub-coding block, the reconstructed pixels of the adjacent block of the first sub-coding block and the prediction mode, wherein the prediction information includes the prediction pixel and the residual value between the original pixel and the prediction pixel; a coding coefficient and reconstructed pixels of the first sub-coding block are generated based on the prediction information of the first sub-coding block; and a bitstream is generated based on the coding coefficient and the prediction information.
本發明之實施例所體現的技術手段可以改善先前技術之缺點的至少其中之一,因此本發明相較於先前技術可以提升預測的速度及準確度。 The technical means embodied in the embodiments of the present invention can improve at least one of the shortcomings of the previous technology, so the present invention can improve the prediction speed and accuracy compared to the previous technology.
有關本發明的特徵、實作與功效,茲配合圖式作實施例詳細說明如下。 The features, implementation and effects of the present invention are described in detail below with reference to the accompanying drawings.
100:電子裝置 100: Electronic devices
110:外部記憶體 110: External memory
120:視訊編碼器 120: Video encoder
121:直接記憶體存取電路 121: Direct memory access circuit
122:記憶體 122: Memory
122A,122B:記憶體區塊 122A, 122B: memory block
123:預測電路 123: Prediction circuit
124:計算電路 124: Computing circuit
125:編碼電路 125: Encoding circuit
210:模式判斷電路 210: Mode determination circuit
Bts:碼流 Bts: bitstream
Coe:編碼係數 Coe: Coding coefficient
Din:視訊資料 Din: Video data
PI:預測資訊 PI: Predicted Information
PI_intra:幀內預測訊息 PI_intra: Intra-frame prediction information
PI_mo:運動訊息 PI_mo: Sports information
PM:預測模式 PM: Prediction model
Rec:重建像素 Rec: Reconstructed pixels
Src:原始像素 Src: original pixel
212:初步模式判斷電路 212: Preliminary mode judgment circuit
214:快速位元率-失真最佳化電路 214: Fast bit rate-distortion optimization circuit
216:完整位元率-失真最佳化電路 216: Complete bit rate-distortion optimization circuit
BM:基礎預測模式 BM: Basic forecasting model
IM:中間預測模式 IM: Intermediate Forecast Model
B(1,2),B(1,3),B(2,3),B(3,1),B(x,y),B(2,1),B(2,2):編碼區塊 B(1,2),B(1,3),B(2,3),B(3,1),B(x,y),B(2,1),B(2,2): coding block
bs(1,1),bs(1,2),bs(2,1),bs(2,2),bs(3,1),bs(3,2),bs(3,3),bs(3,4),bs(4,1),bs(4,2),bs(4,3),bs(4,4),bs16_0~bs16_3,bs8_0~bs8_15,bs4_0~bs4_63:子編碼區塊 bs(1,1),bs(1,2),bs(2,1),bs(2,2),bs(3,1),bs(3,2),bs(3,3),bs(3,4),bs(4,1),bs(4,2),bs(4,3),bs(4,4),bs16_0~bs16_3,bs8_0~bs8_15,bs4_0~bs4_63: sub-coding block
BSL1:第一階子編碼區塊 BSL1: First-level coding block
HCL:水平中線 HCL: Horizontal Center Line
LfB:左邊界 LfB:Left Boundary
LwB:下邊界 LwB: Lower Boundary
RtB:右邊界 RtB:Right Boundary
UpB:上邊界 UpB: upper boundary
VCL:垂直中線 VCL: Vertical Center Line
T1,T2,T3,T4,T5,T6:時間點 T1,T2,T3,T4,T5,T6: time points
BSL2:第二階子編碼區塊 BSL2: Second level coding block
BSL3:第三階子編碼區塊 BSL3: Third level coding block
BSL4:第四階子編碼區塊 BSL4: Fourth level coding block
610,S620,S630,S640,S650,S710,S712,S714,S720,S722,S724,S726,S730,S732,S734,S736,S738,S740,S742,S744,S750,S752,S754,S756,S810,S820,S830,S840:步驟 610,S620,S630,S640,S650,S710,S712,S714,S720,S722,S724,S726,S730,S732,S734,S736,S738,S740,S742,S744,S750,S752,S754,S756,S810,S820,S830,S840: Steps
圖1是本發明電子裝置之一實施例的功能方塊圖;圖2是本發明模式判斷電路之一實施例的功能方塊圖;圖3是本發明之圖幀之一實施例的示意圖;圖4是本發明子編碼區塊的操作時序之一實施例的示意圖;圖5是本發明編碼區塊的更多階的示意圖;圖6是本發明視訊編碼方法之一實施例的流程圖;圖7A至圖7E是本發明第一最佳化操作之一實施例的部分流程圖;以及圖8是本發明第一最佳化操作之另一實施例的部分流程圖。 FIG. 1 is a functional block diagram of an embodiment of the electronic device of the present invention; FIG. 2 is a functional block diagram of an embodiment of the mode determination circuit of the present invention; FIG. 3 is a schematic diagram of an embodiment of the frame of the present invention; FIG. 4 is a schematic diagram of an embodiment of the operation timing of the sub-coding block of the present invention; FIG. 5 is a schematic diagram of a higher level of the coding block of the present invention; FIG. 6 is a flow chart of an embodiment of the video coding method of the present invention; FIG. 7A to FIG. 7E are partial flow charts of an embodiment of the first optimization operation of the present invention; and FIG. 8 is a partial flow chart of another embodiment of the first optimization operation of the present invention.
以下說明內容之技術用語係參照本技術領域之習慣用語,如本說明書對部分用語有加以說明或定義,該部分用語之解釋係以本說明書之說明或定義為準。 The technical terms used in the following descriptions refer to the customary terms in this technical field. If this manual explains or defines some of the terms, the interpretation of those terms shall be based on the explanation or definition in this manual.
本發明之揭露內容包含視訊編碼器與視訊編碼方法。由於本發明之視訊編碼器所包含之部分元件單獨而言可能為已知元件,因此在不影響該裝置發明之充分揭露及可實施性的前提下,以下說明對於已知元件的細節將予以節略。此外,本發明之視訊編碼方法的部分或全部流程可以是軟體及/或韌體之形式,並且可藉由本發明之視訊編碼器或其等效裝置來執行,在不影響該方法發明之充分揭露及可實施性的前提下,以下方法發明之說明將著重於步驟內容而非硬體。 The disclosure of the present invention includes a video encoder and a video encoding method. Since some components included in the video encoder of the present invention may be known components individually, the details of the known components will be omitted in the following description without affecting the full disclosure and feasibility of the device invention. In addition, part or all of the process of the video encoding method of the present invention may be in the form of software and/or firmware, and can be executed by the video encoder of the present invention or its equivalent device. Without affecting the full disclosure and feasibility of the method invention, the following description of the method invention will focus on the step content rather than the hardware.
請參閱圖1,圖1是本發明電子裝置之一實施例的功能方塊圖。電子裝置100包含外部記憶體110及視訊編碼器120。視訊編碼器120包含直 接記憶體存取(Direct Memory Access,DMA)電路121、記憶體122、預測電路123、計算電路124及編碼電路125。記憶體122包含記憶體區塊122A及記憶體區塊122B。預測電路123包含模式判斷電路210。 Please refer to FIG. 1, which is a functional block diagram of an embodiment of the electronic device of the present invention. The electronic device 100 includes an external memory 110 and a video encoder 120. The video encoder 120 includes a direct memory access (DMA) circuit 121, a memory 122, a prediction circuit 123, a calculation circuit 124, and a coding circuit 125. The memory 122 includes a memory block 122A and a memory block 122B. The prediction circuit 123 includes a mode determination circuit 210.
外部記憶體110儲存視訊資料Din。直接記憶體存取電路121從外部記憶體110讀取視訊資料Din中的原始像素Src,並將原始像素Src儲存至記憶體區塊122A。記憶體區塊122B儲存由計算電路124所產生的重建像素Rec。 The external memory 110 stores the video data Din. The direct memory access circuit 121 reads the original pixel Src in the video data Din from the external memory 110 and stores the original pixel Src in the memory block 122A. The memory block 122B stores the reconstructed pixel Rec generated by the calculation circuit 124.
預測電路123根據預測模式PM、原始像素Src及參考圖塊的重建像素Rec產生預測資訊PI。預測資訊PI包含幀間預測訊息如運動訊息PI_mo及幀內預測訊息PI_intra。計算電路124根據預測資訊PI產生重建像素Rec及編碼係數Coe。編碼電路125根據預測資訊PI及編碼係數Coe產生碼流Bts。 The prediction circuit 123 generates prediction information PI according to the prediction mode PM, the original pixel Src and the reconstructed pixel Rec of the reference block. The prediction information PI includes inter-frame prediction information such as motion information PI_mo and intra-frame prediction information PI_intra. The calculation circuit 124 generates the reconstructed pixel Rec and the coding coefficient Coe according to the prediction information PI. The coding circuit 125 generates the bit stream Bts according to the prediction information PI and the coding coefficient Coe.
計算電路124所執行的操作包含變換、量化、逆量化及逆變換及濾波。計算電路124及編碼電路125的操作原理為本技術領域具有通常知識者所熟知,故不再贅述。 The operations performed by the computing circuit 124 include transformation, quantization, inverse quantization, inverse transformation and filtering. The operating principles of the computing circuit 124 and the encoding circuit 125 are well known to those with ordinary knowledge in the technical field, so they will not be elaborated.
請參閱圖2,圖2是本發明模式判斷電路之一實施例的功能方塊圖。模式判斷電路210是預測電路123的一部分,包含初步(rough)模式判斷電路212、快速位元率-失真最佳化電路214及完整位元率-失真最佳化電路216。 Please refer to FIG. 2, which is a functional block diagram of an embodiment of the mode determination circuit of the present invention. The mode determination circuit 210 is a part of the prediction circuit 123, including a rough mode determination circuit 212, a fast bit rate-distortion optimization circuit 214 and a complete bit rate-distortion optimization circuit 216.
初步模式判斷電路212從8個主方向裡選定一個基礎預測模式BM。快速位元率-失真最佳化電路214根據基礎預測模式BM所對應的方向決定6個方向,然後從該基礎預測模式BM所對應的方向、該6個方向及另外3個預設方向(共10個模式)中決定中間預測模式IM。完整位元率-失真最佳化 電路216根據中間預測模式IM決定預測模式PM。在產生中間預測模式IM的過程中,快速位元率-失真最佳化電路214使用原始像素Src或重建像素Rec進行第一最佳化操作。在產生預測模式PM的過程中,完整位元率-失真最佳化電路216使用重建像素Rec進行第二最佳化操作。 The preliminary mode determination circuit 212 selects a basic prediction mode BM from 8 main directions. The fast bit rate-distortion optimization circuit 214 determines 6 directions according to the direction corresponding to the basic prediction mode BM, and then determines the intermediate prediction mode IM from the direction corresponding to the basic prediction mode BM, the 6 directions and the other 3 preset directions (a total of 10 modes). The complete bit rate-distortion optimization circuit 216 determines the prediction mode PM according to the intermediate prediction mode IM. In the process of generating the intermediate prediction mode IM, the fast bit rate-distortion optimization circuit 214 uses the original pixel Src or the reconstructed pixel Rec to perform the first optimization operation. In the process of generating the prediction mode PM, the complete bit rate-distortion optimization circuit 216 uses the reconstructed pixel Rec to perform the second optimization operation.
更明確地說,對I幀(I frame)而言,快速位元率-失真最佳化電路214從該10個模式中選出2個,然後完整位元率-失真最佳化電路216再從該2個模式中決定最終的幀內預測的最佳模式(即,預測模式PM)。對P幀(P frame)而言,快速位元率-失真最佳化電路214執行幀內預測以從該10個模式中選出1個較佳幀內模式,並且執行幀間預測以得到較佳幀間模式,然後完整位元率-失真最佳化電路216比較該較佳幀內模式與該較佳幀間模式,以產生該預測模式PM。 More specifically, for the I frame, the fast rate-distortion optimization circuit 214 selects 2 from the 10 modes, and then the complete rate-distortion optimization circuit 216 determines the final best mode of intra-frame prediction (i.e., prediction mode PM) from the 2 modes. For the P frame, the fast rate-distortion optimization circuit 214 performs intra-frame prediction to select a better intra-frame mode from the 10 modes, and performs inter-frame prediction to obtain a better inter-frame mode, and then the complete rate-distortion optimization circuit 216 compares the better intra-frame mode with the better inter-frame mode to generate the prediction mode PM.
請參閱圖3,圖3是本發明之圖幀之一實施例的示意圖。一個幀包含多個編碼區塊(B(1,1)、B(1,2)、B(1,3)、……、B(2,1)、B(2,2)、B(2,3)、……、B(3,1)、……),每一個編碼區塊包含多個第一階(level)子編碼區塊BSL1。舉例來說,編碼區塊B(1,1)的第一階子編碼區塊BSL1包含子編碼區塊bs(1,1)、bs(1,2)、bs(2,1)及bs(2,2);編碼區塊B(2,1)的第一階子編碼區塊BSL1包含子編碼區塊bs(3,1)、bs(3,2)、bs(4,1)及bs(4,2);編碼區塊B(2,2)的第一階子編碼區塊BSL1包含子編碼區塊bs(3,3)、bs(3,4)、bs(4,3)及bs(4,4)。B(1,1)、B(1,2)、B(1,3)連續排列,且B(2,1)、B(2,2)、B(2,3)連續排列。 Please refer to Figure 3, which is a schematic diagram of an embodiment of a frame of the present invention. A frame includes a plurality of coding blocks (B(1,1), B(1,2), B(1,3), ..., B(2,1), B(2,2), B(2,3), ..., B(3,1), ...), each coding block includes a plurality of first-level sub-coding blocks BSL1. For example, the first-order sub-coding block BSL1 of coding block B(1,1) includes sub-coding blocks bs(1,1), bs(1,2), bs(2,1) and bs(2,2); the first-order sub-coding block BSL1 of coding block B(2,1) includes sub-coding blocks bs(3,1), bs(3,2), bs(4,1) and bs(4,2); the first-order sub-coding block BSL1 of coding block B(2,2) includes sub-coding blocks bs(3,3), bs(3,4), bs(4,3) and bs(4,4). B(1,1), B(1,2), B(1,3) are arranged consecutively, and B(2,1), B(2,2), B(2,3) are arranged consecutively.
視訊編碼器120以從左到右及從上到下的方式依序處理編碼區塊(即,根據以下的順序:B(1,1)→B(1,2)→B(1,3)→……→B(2,1)→B(2,2)→B(2,3)→……→B(3,1)→……),並且以「Z」字形的順序(Z-order)處理子編 碼區塊(即,以第二列的編碼區塊為例,根據以下的順序:bs(3,1)→bs(3,2)→bs(4,1)→bs(4,2)→bs(3,3)→bs(3,4)→bs(4,3)→bs(4,4)→……)。 The video encoder 120 processes the coding blocks in order from left to right and from top to bottom (i.e., according to the following order: B(1,1)→B(1,2)→B(1,3)→…→B(2,1)→B(2,2)→B(2,3)→…→B(3,1)→…), and processes the sub-coding blocks in a "Z" order (i.e., taking the coding blocks in the second row as an example, according to the following order: bs(3,1)→bs(3,2)→bs(4,1)→bs(4,2)→bs(3,3)→bs(3,4)→bs(4,3)→bs(4,4)→…).
每一個編碼區塊(請參閱右下角的編碼區塊B(x,y))具有上邊界UpB(或上邊)、下邊界LwB(或下邊)、左邊界LfB(或左邊)及右邊界RtB(或右邊)。每一編碼區塊被一條水平中線HCL均分,以及被一條垂直中線VCL均分。水平中線HCL平行於上邊界UpB及下邊界LwB,而垂直中線VCL平行於左邊界LfB及右邊界RtB。 Each coding block (see the coding block B(x,y) in the lower right corner) has an upper boundary UpB (or top), a lower boundary LwB (or bottom), a left boundary LfB (or left), and a right boundary RtB (or right). Each coding block is divided equally by a horizontal center line HCL and a vertical center line VCL. The horizontal center line HCL is parallel to the upper boundary UpB and the lower boundary LwB, while the vertical center line VCL is parallel to the left boundary LfB and the right boundary RtB.
請參閱圖4,圖4是本發明子編碼區塊的操作時序之一實施例的示意圖。圖4是以編碼區塊B(2,1)及編碼區塊B(2,2)為例。視訊編碼器120對某一子編碼區塊(例如,子編碼區塊bs(3,1))先進行第一階段的操作再進行第二階段的操作,並且同時對在處理順序上連續的兩子編碼區塊分別進行第一階段的操作及第二階段的操作(例如,在對子編碼區塊bs(3,1)進行第二階段的操作同時對子編碼區塊bs(3,2)進行第一階段的操作)。第一階段的操作包含但不限於快速位元率-失真最佳化電路214根據基礎預測模式BM產生中間預測模式IM。第二階段的操作包含但不限於完整位元率-失真最佳化電路216根據中間預測模式IM產生預測模式PM。 Please refer to FIG. 4, which is a schematic diagram of an embodiment of the operation timing of the sub-coding block of the present invention. FIG. 4 takes coding block B(2,1) and coding block B(2,2) as examples. The video encoder 120 first performs the first stage operation and then the second stage operation on a certain sub-coding block (for example, sub-coding block bs(3,1)), and simultaneously performs the first stage operation and the second stage operation on two sub-coding blocks that are consecutive in the processing sequence (for example, performing the second stage operation on sub-coding block bs(3,1) while performing the first stage operation on sub-coding block bs(3,2)). The operation of the first stage includes but is not limited to the fast bit rate-distortion optimization circuit 214 generating an intermediate prediction mode IM according to the basic prediction mode BM. The operation of the second stage includes but is not limited to the complete bit rate-distortion optimization circuit 216 generating a prediction mode PM according to the intermediate prediction mode IM.
舉例來說,在時間點T5與時間點T6之間,當完整位元率-失真最佳化電路216正在對子編碼區塊bs(4,2)進行第二階段的操作時,快速位元率-失真最佳化電路214正在對子編碼區塊bs(3,3)進行第一階段的操作。 For example, between time point T5 and time point T6, when the complete bit rate-distortion optimization circuit 216 is performing the second stage operation on the sub-coding block bs(4,2), the fast bit rate-distortion optimization circuit 214 is performing the first stage operation on the sub-coding block bs(3,3).
需注意的是,在某個子編碼區塊的第二階段結束前,對應於該子編碼區塊的重建像素Rec不會全部產生。舉例來說,子編碼區塊bs(4,2)的重建像素Rec直到時間點T6才會全部產生。 It should be noted that before the second phase of a sub-coding block ends, the reconstructed pixels Rec corresponding to the sub-coding block will not be completely generated. For example, the reconstructed pixels Rec of the sub-coding block bs(4,2) will not be completely generated until time point T6.
請參閱圖5,圖5是本發明編碼區塊的更多階的示意圖。在這裡假設圖3的一個編碼區塊(例如編碼區塊B(2,2))的大小是64*64像素,則,該編碼區塊的任一第一階子編碼區塊BSL1(例如子編碼區塊bs(3,3))的大小是32*32像素,並且包含4個大小為16*16像素的子編碼區塊(即,bs16_0、bs16_1、bs16_2、bs16_3,統稱為該編碼區塊的第二階子編碼區塊BSL2)、16個大小為8*8像素的子編碼區塊(即,bs8_0、bs8_1、bs8_2、……、bs8_14、bs8_15,統稱為該編碼區塊的第三階子編碼區塊BSL3),以及64個大小為4*4像素的子編碼區塊(即,bs4_0、bs4_1、bs4_2、……、bs4_62、bs4_63,統稱為該編碼區塊的第四階子編碼區塊BSL4)。 Please refer to FIG. 5, which is a schematic diagram of a coding block of the present invention at a higher level. Assume here that the size of a coding block in FIG. 3 (e.g., coding block B(2,2)) is 64*64 pixels, then the size of any first-level sub-coding block BSL1 of the coding block (e.g., sub-coding block bs(3,3)) is 32*32 pixels, and includes 4 sub-coding blocks of 16*16 pixels (i.e., bs16_0, bs16_1, bs16_2, bs16_3, collectively referred to as the second-level sub-coding block BS of the coding block). L2), 16 sub-coding blocks of 8*8 pixels (i.e., bs8_0, bs8_1, bs8_2, ..., bs8_14, bs8_15, collectively referred to as the third-order sub-coding block BSL3 of the coding block), and 64 sub-coding blocks of 4*4 pixels (i.e., bs4_0, bs4_1, bs4_2, ..., bs4_62, bs4_63, collectively referred to as the fourth-order sub-coding block BSL4 of the coding block).
請繼續參閱圖5。子編碼區塊bs16_0包含子編碼區塊bs8_0、子編碼區塊bs8_1、子編碼區塊bs8_2及子編碼區塊bs8_3;子編碼區塊bs16_1包含子編碼區塊bs8_4、子編碼區塊bs8_5、子編碼區塊bs8_6及子編碼區塊bs87;以此類推。子編碼區塊bs8_0包含子編碼區塊bs4_0、子編碼區塊bs41、子編碼區塊bs4_2及子編碼區塊bs4_3;子編碼區塊bs8_1包含子編碼區塊bs4_4、子編碼區塊bs4_5、子編碼區塊bs4_6及子編碼區塊bs4_7;以此類推。 Please continue to refer to FIG5. The sub-coding block bs16_0 includes the sub-coding block bs8_0, the sub-coding block bs8_1, the sub-coding block bs8_2 and the sub-coding block bs8_3; the sub-coding block bs16_1 includes the sub-coding block bs8_4, the sub-coding block bs8_5, the sub-coding block bs8_6 and the sub-coding block bs87; and so on. Subcoding block bs8_0 includes subcoding block bs4_0, subcoding block bs41, subcoding block bs4_2 and subcoding block bs4_3; subcoding block bs8_1 includes subcoding block bs4_4, subcoding block bs4_5, subcoding block bs4_6 and subcoding block bs4_7; and so on.
需注意的是,視訊編碼器120對各階(即,第一階子編碼區塊BSL1、第二階子編碼區塊BSL2、第三階子編碼區塊BSL3及第四階子編碼區塊BSL4)各別進行編碼操作。在各階中,視訊編碼器120以子編碼區塊的編號(即,bsP_Q中的P為16、8或4,Q為0~3、0~15或0~63)依序處理子編碼區塊(即,以圖中箭頭所示的順序)。 It should be noted that the video encoder 120 performs encoding operations on each level (i.e., the first-level sub-coding block BSL1, the second-level sub-coding block BSL2, the third-level sub-coding block BSL3, and the fourth-level sub-coding block BSL4) separately. In each level, the video encoder 120 processes the sub-coding blocks in sequence (i.e., in the order shown by the arrows in the figure) according to the number of the sub-coding blocks (i.e., P in bsP_Q is 16, 8, or 4, and Q is 0~3, 0~15, or 0~63).
請參閱圖6,圖6是本發明視訊編碼方法之一實施例的流程圖, 包含以下步驟。 Please refer to Figure 6, which is a flow chart of an embodiment of the video encoding method of the present invention, which includes the following steps.
步驟S610:快速位元率-失真最佳化電路214對子編碼區塊執行第一最佳化操作,以根據基礎預測模式BM選擇該子編碼區塊的一相鄰塊的原始像素或重建像素來產生該子編碼區塊的中間預測模式IM。舉例來說(請參閱圖3),如果子編碼區塊是bs(3,3),則快速位元率-失真最佳化電路214在此步驟中所使用的像素包含子編碼區塊bs(3,3)本身的原始像素Src以及相鄰塊(例如子編碼區塊bs(4,2),可以視為子編碼區塊bs(3,3)的參考子編碼區塊)的原始像素Src或重建像素Rec。 Step S610: The fast bit rate-distortion optimization circuit 214 performs a first optimization operation on the sub-coding block to select the original pixels or reconstructed pixels of a neighboring block of the sub-coding block according to the basic prediction mode BM to generate the intermediate prediction mode IM of the sub-coding block. For example (see FIG. 3 ), if the sub-coding block is bs(3,3), the pixels used by the fast bit rate-distortion optimization circuit 214 in this step include the original pixels Src of the sub-coding block bs(3,3) itself and the original pixels Src or reconstructed pixels Rec of the neighboring block (e.g., the sub-coding block bs(4,2), which can be regarded as the reference sub-coding block of the sub-coding block bs(3,3)).
步驟S620:完整位元率-失真最佳化電路216對該子編碼區塊執行第二最佳化操作,以根據中間預測模式IM、該子編碼區塊的原始像素Src及該子編碼區塊的相鄰塊的重建像素Rec決定預測模式PM。舉例來說(請參閱圖3),如果子編碼區塊是bs(3,3),則完整位元率-失真最佳化電路216在此步驟中所使用的像素包含子編碼區塊bs(3,3)本身的原始像素Src以及相鄰塊(例如子編碼區塊bs(4,2))的重建像素Rec,但完整位元率-失真最佳化電路216可以不需要相鄰塊的原始像素Src。 Step S620: The complete rate-distortion optimization circuit 216 performs a second optimization operation on the sub-coding block to determine the prediction mode PM according to the intermediate prediction mode IM, the original pixels Src of the sub-coding block, and the reconstructed pixels Rec of the adjacent blocks of the sub-coding block. For example (see FIG. 3 ), if the sub-coding block is bs(3,3), the pixels used by the complete rate-distortion optimization circuit 216 in this step include the original pixels Src of the sub-coding block bs(3,3) itself and the reconstructed pixels Rec of the adjacent blocks (e.g., the sub-coding block bs(4,2)), but the complete rate-distortion optimization circuit 216 may not need the original pixels Src of the adjacent blocks.
步驟S630:預測電路123根據子編碼區塊的原始像素Src、子編碼區塊的相鄰塊的重建像素Rec及預測模式PM產生預測資訊PI。預測資訊PI包括幀內預測模式下的預測像素Prc、及原始像素Src與預測像素Prc之間的殘差值RV。本領域技術人員熟知,預測像素Prc係在預測模式PM下基於重建像素Rec而產生。 Step S630: The prediction circuit 123 generates prediction information PI according to the original pixel Src of the sub-coding block, the reconstructed pixel Rec of the adjacent block of the sub-coding block and the prediction mode PM. The prediction information PI includes the prediction pixel Prc in the intra-frame prediction mode and the residual value RV between the original pixel Src and the prediction pixel Prc. It is well known to those skilled in the art that the prediction pixel Prc is generated based on the reconstructed pixel Rec in the prediction mode PM.
步驟S640:計算電路124根據子編碼區塊的預測資訊PI產生子編碼區塊的編碼係數Coe及重建像素Rec。 Step S640: The calculation circuit 124 generates the coding coefficient Coe and reconstructed pixel Rec of the sub-coding block according to the prediction information PI of the sub-coding block.
步驟S650:編碼電路125根據編碼係數Coe及預測資訊PI產生碼流Bts。 Step S650: The coding circuit 125 generates a bit stream Bts according to the coding coefficient Coe and the prediction information PI.
請參閱圖7A至圖7E,圖7A至圖7E是本發明第一最佳化操作之一實施例的部分流程圖。在以下的說明中假設編碼區塊B(2,2)是目標編碼區塊。 Please refer to Figures 7A to 7E, which are partial flow charts of one embodiment of the first optimization operation of the present invention. In the following description, it is assumed that the coding block B (2, 2) is the target coding block.
請參閱圖7A,圖7A包含以下步驟。 Please refer to Figure 7A, which contains the following steps.
步驟S710:快速位元率-失真最佳化電路214從一個目標編碼區塊的複數個子編碼區塊中決定一目標子編碼區塊。請參閱圖3及圖5。舉例來說,目標子編碼區塊可以是第一階子編碼區塊BSL1的其中之一(即,子編碼區塊bs(3,3)、子編碼區塊bs(3,4)、子編碼區塊bs(4,3)及子編碼區塊bs(4,4)的其中之一)、第二階子編碼區塊BSL2的其中之一(即,bs16_k,0≦k≦3)、第三階子編碼區塊BSL3的其中之一(即,bs8_k,0≦k≦15)或第四階子編碼區塊BSL4的其中之一(即,bs4_k,0≦k≦63)。 Step S710: The fast bit rate-distortion optimization circuit 214 determines a target sub-coding block from a plurality of sub-coding blocks of a target coding block. Please refer to FIG. 3 and FIG. 5. For example, the target subcoding block may be one of the first-order subcoding blocks BSL1 (i.e., one of subcoding blocks bs(3,3), bs(3,4), bs(4,3) and bs(4,4)), one of the second-order subcoding blocks BSL2 (i.e., bs16_k, 0≦k≦3), one of the third-order subcoding blocks BSL3 (i.e., bs8_k, 0≦k≦15) or one of the fourth-order subcoding blocks BSL4 (i.e., bs4_k, 0≦k≦63).
步驟S712:快速位元率-失真最佳化電路214判斷目前的預測方向是否為上方。如果是,則執行圖7B的步驟;否則,執行步驟S714。 Step S712: The fast bit rate-distortion optimization circuit 214 determines whether the current prediction direction is upward. If yes, execute the step of FIG. 7B; otherwise, execute step S714.
步驟S714:快速位元率-失真最佳化電路214判斷目前的預測方向為右上方、左方或左下方。如果目前的預測方向為右上方,則執行圖7C的步驟;如果目前的預測方向為左方,則執行圖7D的步驟;如果目前的預測方向為左下方,則執行圖7E的步驟。 Step S714: The fast bit rate-distortion optimization circuit 214 determines whether the current prediction direction is the upper right, left, or lower left. If the current prediction direction is the upper right, the step of FIG. 7C is executed; if the current prediction direction is the left, the step of FIG. 7D is executed; if the current prediction direction is the lower left, the step of FIG. 7E is executed.
請參閱圖7B,圖7B包含以下步驟。 Please refer to Figure 7B, which includes the following steps.
步驟S720:快速位元率-失真最佳化電路214判斷目標子編碼區塊是否鄰接(adjacent)目標編碼區塊的上邊界。當目標子編碼區塊鄰接目標編 碼區塊的上邊界(下邊界、左邊界、右邊界)時,代表該目標子編碼區塊的上邊界(下邊界、左邊界、右邊界)與該目標編碼區塊的上邊界(下邊界、左邊界、右邊界)實質上重疊,或是代表該目標子編碼區塊的上邊界(下邊界、左邊界、右邊界)是該目標編碼區塊的上邊界(下邊界、左邊界、右邊界)的一部分。 Step S720: The fast bit rate-distortion optimization circuit 214 determines whether the target sub-coding block is adjacent to the upper boundary of the target coding block. When the target sub-coding block is adjacent to the upper boundary (lower boundary, left boundary, right boundary) of the target coding block, it means that the upper boundary (lower boundary, left boundary, right boundary) of the target sub-coding block and the upper boundary (lower boundary, left boundary, right boundary) of the target coding block are substantially overlapped, or it means that the upper boundary (lower boundary, left boundary, right boundary) of the target sub-coding block is a part of the upper boundary (lower boundary, left boundary, right boundary) of the target coding block.
請參閱圖3及圖5。對編碼區塊B(2,2)而言,當目標子編碼區塊是子編碼區塊bs(3,3)、子編碼區塊bs(3,4)、子編碼區塊bs16_0、子編碼區塊bs16_1、子編碼區塊bs8_0、子編碼區塊bs8_1、子編碼區塊bs8_4、子編碼區塊bs8_5、子編碼區塊bs4_0、子編碼區塊bs4_1、子編碼區塊bs4_4、子編碼區塊bs4_5、子編碼區塊bs4_16、子編碼區塊bs4_17、子編碼區塊bs4_20、子編碼區塊bs4_21的其中之一時,步驟S720的結果為是(前往步驟S724);當目標子編碼區塊是其他的子編碼區塊時,步驟S720的結果為否(前往步驟S722)。 Please refer to Figures 3 and 5. For coding block B(2,2), when the target subcoding block is subcoding block bs(3,3), subcoding block bs(3,4), subcoding block bs16_0, subcoding block bs16_1, subcoding block bs8_0, subcoding block bs8_1, subcoding block bs8_4, subcoding block bs8_5, subcoding block bs4_0, subcoding block bs4_1, When the target subcoding block is one of the subcoding blocks bs4_4, bs4_5, bs4_16, bs4_17, bs4_20, and bs4_21, the result of step S720 is yes (go to step S724); when the target subcoding block is another subcoding block, the result of step S720 is no (go to step S722).
步驟S722:快速位元率-失真最佳化電路214判斷目標子編碼區塊的上邊界是否鄰接目標編碼區塊的水平中線HCL。請參閱圖3,子編碼區塊bs(3,3)及子編碼區塊bs(3,4)的上邊界不鄰接水平中線HCL,而子編碼區塊bs(4,3)及子編碼區塊bs(4,4)的上邊界鄰接水平中線HCL。請參閱圖5,對子編碼區塊bs(4,3)及子編碼區塊bs(4,4)而言,子編碼區塊bs16_0、子編碼區塊bs16_1、子編碼區塊bs8_0、子編碼區塊bs8_1、子編碼區塊bs8_4、子編碼區塊bs8_5、子編碼區塊bs4_0、子編碼區塊bs4_1、子編碼區塊bs4_4、子編碼區塊bs4_5、子編碼區塊bs4_16、子編碼區塊bs4_17、子編碼區塊bs4_20及子編碼區塊bs4_21的上邊界鄰接水平中線HCL。 Step S722: The fast bit rate-distortion optimization circuit 214 determines whether the upper boundary of the target sub-coding block is adjacent to the horizontal center line HCL of the target coding block. Please refer to FIG3 , the upper boundaries of the sub-coding block bs(3,3) and the sub-coding block bs(3,4) are not adjacent to the horizontal center line HCL, while the upper boundaries of the sub-coding block bs(4,3) and the sub-coding block bs(4,4) are adjacent to the horizontal center line HCL. Please refer to FIG. 5. For subcoding block bs(4,3) and subcoding block bs(4,4), the upper boundaries of subcoding block bs16_0, subcoding block bs16_1, subcoding block bs8_0, subcoding block bs8_1, subcoding block bs8_4, subcoding block bs8_5, subcoding block bs4_0, subcoding block bs4_1, subcoding block bs4_4, subcoding block bs4_5, subcoding block bs4_16, subcoding block bs4_17, subcoding block bs4_20, and subcoding block bs4_21 are adjacent to the horizontal center line HCL.
步驟S724:快速位元率-失真最佳化電路214使用該目標子編碼區塊上方的相鄰塊的重建像素Rec進行預測。對第一種狀況而言(步驟S720的結果為是),因為子編碼區塊bs(3,3)及子編碼區塊bs(3,4)上方的相鄰塊(編碼區塊B(1,2))的第二階段操作已完成,所以快速位元率-失真最佳化電路214可以使用該相鄰塊的重建像素Rec進行預測。對第二種狀況而言(步驟S722的結果為是),因為子編碼區塊bs(4,3)及子編碼區塊bs(4,4)上方的相鄰塊(分別為子編碼區塊bs(3,3)及子編碼區塊bs(3,4))的第二階段操作已完成,所以快速位元率-失真最佳化電路214可以使用該相鄰塊的重建像素Rec進行預測。 Step S724: The fast bit rate-distortion optimization circuit 214 uses the reconstructed pixels Rec of the neighboring block above the target sub-coding block for prediction. For the first case (the result of step S720 is yes), since the second phase operation of the neighboring block above the sub-coding block bs(3,3) and the sub-coding block bs(3,4) (coding block B(1,2)) has been completed, the fast bit rate-distortion optimization circuit 214 can use the reconstructed pixels Rec of the neighboring block for prediction. For the second case (the result of step S722 is yes), since the second stage operation of the sub-coding block bs(4,3) and the adjacent blocks above the sub-coding block bs(4,4) (respectively, the sub-coding block bs(3,3) and the sub-coding block bs(3,4)) has been completed, the fast bit rate-distortion optimization circuit 214 can use the reconstructed pixels Rec of the adjacent blocks for prediction.
在一些實施例中,快速位元率-失真最佳化電路214執行第一最佳化時所需要的重建像素Rec的數量與目標子編碼區塊的大小有關,而且所需要的重建像素Rec與目標編碼區塊的邊界相鄰。舉例來說,當目標子編碼區塊的大小是32*32(16*16、8*8、4*4)像素時,快速位元率-失真最佳化電路214需要32(16、8、4)個重建像素Rec,而且該32(16、8、4)個重建像素Rec與目標子編碼區塊的邊界相鄰。在一些實施例中,快速位元率-失真最佳化電路214從記憶體122的線緩衝器(line buffer)(圖未示,例如,記憶體區塊122B的一部分)中讀取所需的重建像素Rec。 In some embodiments, the number of reconstructed pixels Rec required by the fast bit rate-distortion optimization circuit 214 when performing the first optimization is related to the size of the target sub-coding block, and the required reconstructed pixels Rec are adjacent to the boundary of the target sub-coding block. For example, when the size of the target sub-coding block is 32*32 (16*16, 8*8, 4*4) pixels, the fast bit rate-distortion optimization circuit 214 requires 32 (16, 8, 4) reconstructed pixels Rec, and the 32 (16, 8, 4) reconstructed pixels Rec are adjacent to the boundary of the target sub-coding block. In some embodiments, the fast bit rate-distortion optimization circuit 214 reads the required reconstructed pixel Rec from the line buffer of the memory 122 (not shown, for example, a portion of the memory block 122B).
步驟S726:快速位元率-失真最佳化電路214使用該目標子編碼區塊上方的相鄰塊的原始像素Src進行預測。當目標子編碼區塊在預測方向上沒有鄰接已完成第二階段操作的第一階子編碼區塊BSL1時,快速位元率-失真最佳化電路214只能使用相鄰塊的原始像素Src進行預測。也就是說,當快速位元率-失真最佳化電路214無法從相鄰塊取得所需的重建像素Rec時,快速位元率-失真最佳化電路214改為使用相鄰塊的原始像素Src進行預測。 Step S726: The fast bit rate-distortion optimization circuit 214 uses the original pixel Src of the neighboring block above the target sub-coding block for prediction. When the target sub-coding block is not adjacent to the first-stage sub-coding block BSL1 that has completed the second-stage operation in the prediction direction, the fast bit rate-distortion optimization circuit 214 can only use the original pixel Src of the neighboring block for prediction. In other words, when the fast bit rate-distortion optimization circuit 214 cannot obtain the required reconstructed pixel Rec from the neighboring block, the fast bit rate-distortion optimization circuit 214 uses the original pixel Src of the neighboring block for prediction instead.
請參閱圖7C,圖7C包含以下步驟。 Please refer to Figure 7C, which includes the following steps.
步驟S730:快速位元率-失真最佳化電路214判斷目標子編碼區塊是否鄰接目標編碼區塊的上邊界。此步驟與步驟S720相同。如果步驟S730的結果為是,快速位元率-失真最佳化電路214執行步驟S732;否則,快速位元率-失真最佳化電路214執行步驟S734。 Step S730: The fast bit rate-distortion optimization circuit 214 determines whether the target sub-coding block is adjacent to the upper boundary of the target coding block. This step is the same as step S720. If the result of step S730 is yes, the fast bit rate-distortion optimization circuit 214 executes step S732; otherwise, the fast bit rate-distortion optimization circuit 214 executes step S734.
步驟S732:快速位元率-失真最佳化電路214使用該目標子編碼區塊右上方的相鄰塊的重建像素Rec進行預測。請參考步驟S724的說明。舉例來說,因為目標編碼區塊(編碼區塊B(2,2))的上方的編碼區塊(編碼區塊B(1,2))及右上方的編碼區塊(編碼區塊B(1,3))的第二階段操作已完成,所以快速位元率-失真最佳化電路214可以使用編碼區塊B(1,2)與編碼區塊B(1,3)的重建像素Rec進行預測。 Step S732: The fast bit rate-distortion optimization circuit 214 uses the reconstructed pixels Rec of the neighboring block to the upper right of the target sub-coding block for prediction. Please refer to the description of step S724. For example, because the second-stage operation of the coding block above (coding block B(1,2)) and the coding block to the upper right (coding block B(1,3)) of the target coding block (coding block B(2,2)) has been completed, the fast bit rate-distortion optimization circuit 214 can use the reconstructed pixels Rec of coding block B(1,2) and coding block B(1,3) for prediction.
步驟S734:快速位元率-失真最佳化電路214判斷目標子編碼區塊的上邊界是否鄰接目標編碼區塊的水平中線HCL。請參考步驟S722的說明。 Step S734: The fast bit rate-distortion optimization circuit 214 determines whether the upper boundary of the target sub-coding block is adjacent to the horizontal center line HCL of the target coding block. Please refer to the description of step S722.
步驟S736:快速位元率-失真最佳化電路214判斷目標子編碼區塊的右邊界是否鄰接目標編碼區塊的右邊界或垂直中線VCL。請參閱圖3及圖5,舉例來說,對子編碼區塊bs(4,3)及其子編碼區塊bs16_1、子編碼區塊bs8_5與子編碼區塊bs4_21而言,因為其右邊界鄰接目標編碼區塊的垂直中線VCL,所以步驟S736的結果為是;對子編碼區塊bs(4,4)及其子編碼區塊bs16_1、子編碼區塊bs8_5與子編碼區塊bs4_21而言,因為其右邊界鄰接目標編碼區塊的右邊界RtB,所以步驟S736的結果為是。對其他上邊界鄰接水平中線HCL的子編碼區塊而言,步驟S736的結果為否。 Step S736: The fast bit rate-distortion optimization circuit 214 determines whether the right boundary of the target sub-coding block is adjacent to the right boundary of the target coding block or the vertical center line VCL. Please refer to Figures 3 and 5. For example, for the sub-coding block bs(4,3) and its sub-coding block bs16_1, sub-coding block bs8_5 and sub-coding block bs4_21, since their right boundaries are adjacent to the vertical center line VCL of the target coding block, the result of step S736 is yes; for the sub-coding block bs(4,4) and its sub-coding block bs16_1, sub-coding block bs8_5 and sub-coding block bs4_21, since their right boundaries are adjacent to the right boundary RtB of the target coding block, the result of step S736 is yes. For other sub-coding blocks whose upper boundaries are adjacent to the horizontal center line HCL, the result of step S736 is no.
步驟S738:快速位元率-失真最佳化電路214使用該目標子編碼區塊右上方的相鄰塊的原始像素Src進行預測。請參考步驟S726的說明。舉例來說,對子編碼區塊bs(4,3)(或子編碼區塊bs(4,4))的子編碼區塊bs16_1而言,因為其右上方的相對應的子編碼區塊(即,相鄰塊)是子編碼區塊bs(3,4)(或編碼區塊B(2,3))的一部分,而子編碼區塊bs(3,4)(或編碼區塊B(2,3))尚未完成(或尚未開始)第二階段的操作,所以此時快速位元率-失真最佳化電路214改為使用相鄰塊(即,子編碼區塊bs(3,4)(或編碼區塊B(2,3)))的原始像素Src進行預測。 Step S738: The fast bit rate-distortion optimization circuit 214 uses the original pixel Src of the upper right neighboring block of the target sub-coding block for prediction. Please refer to the description of step S726. For example, for the sub-coding block bs16_1 of the sub-coding block bs(4,3) (or the sub-coding block bs(4,4)), because the corresponding sub-coding block (i.e., the adjacent block) to the upper right is part of the sub-coding block bs(3,4) (or the coding block B(2,3)), and the sub-coding block bs(3,4) (or the coding block B(2,3)) has not yet completed (or started) the second stage operation, the fast bit rate-distortion optimization circuit 214 now uses the original pixel Src of the adjacent block (i.e., the sub-coding block bs(3,4) (or the coding block B(2,3))) for prediction.
請參閱圖7D,圖7D包含以下步驟。 Please refer to Figure 7D, which contains the following steps.
步驟S740:快速位元率-失真最佳化電路214判斷目標子編碼區塊是否鄰接目標編碼區塊的左邊界。請參閱圖3,子編碼區塊bs(3,3)及子編碼區塊bs(4,3)鄰接編碼區塊B(2,2)的左邊界,而子編碼區塊bs(3,4)及子編碼區塊bs(4,4)不鄰接編碼區塊B(2,2)的左邊界。請參閱圖5,對子編碼區塊bs(3,3)及子編碼區塊bs(4,3)而言,子編碼區塊bs16_0、子編碼區塊bs16_2、子編碼區塊bs8_0、子編碼區塊bs8_2、子編碼區塊bs8_8、子編碼區塊bs8_10、子編碼區塊bs4_0、子編碼區塊bs4_2、子編碼區塊bs4_8、子編碼區塊bs4_10、子編碼區塊bs4_32、子編碼區塊bs4_34、子編碼區塊bs4_40及子編碼區塊bs4_42鄰接編碼區塊B(2,2)的左邊界。 Step S740: The fast bit rate-distortion optimization circuit 214 determines whether the target sub-coding block is adjacent to the left boundary of the target coding block. Referring to FIG. 3 , sub-coding block bs(3,3) and sub-coding block bs(4,3) are adjacent to the left boundary of coding block B(2,2), while sub-coding block bs(3,4) and sub-coding block bs(4,4) are not adjacent to the left boundary of coding block B(2,2). Please refer to Figure 5. For sub-coding block bs(3,3) and sub-coding block bs(4,3), sub-coding block bs16_0, sub-coding block bs16_2, sub-coding block bs8_0, sub-coding block bs8_2, sub-coding block bs8_8, sub-coding block bs8_10, sub-coding block bs4_0, sub-coding block bs4_2, sub-coding block bs4_8, sub-coding block bs4_10, sub-coding block bs4_32, sub-coding block bs4_34, sub-coding block bs4_40 and sub-coding block bs4_42 are adjacent to the left boundary of coding block B(2,2).
步驟S742:快速位元率-失真最佳化電路214使用該目標子編碼區塊左方的相鄰塊的重建像素Rec進行預測。請參考步驟S724的說明。舉例來說,因為當快速位元率-失真最佳化電路214處理子編碼區塊bs(3,3)(或子編碼區塊bs(4,3))時,其左方的對應的子編碼區塊bs(3,2)(或子編碼區塊 bs(4,2))(即,相鄰塊)的第二階段操作已完成,所以快速位元率-失真最佳化電路214可以使用相鄰塊(即,子編碼區塊bs(3,2)(或子編碼區塊bs(4,2)))的重建像素Rec進行預測。 Step S742: The fast bit rate-distortion optimization circuit 214 uses the reconstructed pixels Rec of the neighboring block to the left of the target sub-coding block for prediction. Please refer to the description of step S724. For example, when the fast bit rate-distortion optimization circuit 214 processes the sub-coding block bs(3,3) (or the sub-coding block bs(4,3)), the second stage operation of the corresponding sub-coding block bs(3,2) (or the sub-coding block bs(4,2)) on the left (i.e., the adjacent block) has been completed, so the fast bit rate-distortion optimization circuit 214 can use the reconstructed pixel Rec of the adjacent block (i.e., the sub-coding block bs(3,2) (or the sub-coding block bs(4,2))) for prediction.
步驟S744:快速位元率-失真最佳化電路214使用該目標子編碼區塊左方的相鄰塊的原始像素Src進行預測。當快速位元率-失真最佳化電路214無法取得所需的重建像素Rec時,快速位元率-失真最佳化電路214改為使用相鄰塊的原始像素Src進行預測。 Step S744: The fast bit rate-distortion optimization circuit 214 uses the original pixel Src of the neighboring block to the left of the target sub-coding block for prediction. When the fast bit rate-distortion optimization circuit 214 cannot obtain the required reconstructed pixel Rec, the fast bit rate-distortion optimization circuit 214 uses the original pixel Src of the neighboring block for prediction instead.
請參閱圖7E,圖7E包含以下步驟。 Please refer to Figure 7E, which contains the following steps.
步驟S750:快速位元率-失真最佳化電路214判斷目標子編碼區塊是否鄰接目標編碼區塊的左邊界。請參考步驟S740的說明。 Step S750: The fast bit rate-distortion optimization circuit 214 determines whether the target sub-coding block is adjacent to the left boundary of the target coding block. Please refer to the description of step S740.
步驟S752:快速位元率-失真最佳化電路214判斷目標子編碼區塊的下邊界是否鄰接目標編碼區塊的下邊界或水平中線HCL。請參閱圖3及圖5。舉例來說,對子編碼區塊bs(3,3)及其子編碼區塊bs16_2、子編碼區塊bs8_10與子編碼區塊bs4_42而言,因為其下邊界鄰接目標編碼區塊的水平中線HCL,所以步驟S752的結果為是;對子編碼區塊bs(4,3)及其子編碼區塊bs16_2、子編碼區塊bs8_10與子編碼區塊bs4_42而言,因為其下邊界鄰接目標編碼區塊的下邊界,所以步驟S752的結果為是。對其他鄰接編碼區塊B(2,2)的左邊界的子編碼區塊而言,步驟S752的結果為否。 Step S752: The fast bit rate-distortion optimization circuit 214 determines whether the lower boundary of the target sub-coding block is adjacent to the lower boundary of the target coding block or the horizontal center line HCL. Please refer to FIG. 3 and FIG. 5. For example, for sub-coding block bs(3,3) and its sub-coding block bs16_2, sub-coding block bs8_10 and sub-coding block bs4_42, since their lower boundaries are adjacent to the horizontal center line HCL of the target coding block, the result of step S752 is yes; for sub-coding block bs(4,3) and its sub-coding block bs16_2, sub-coding block bs8_10 and sub-coding block bs4_42, since their lower boundaries are adjacent to the lower boundary of the target coding block, the result of step S752 is yes. For other sub-coding blocks adjacent to the left boundary of coding block B(2,2), the result of step S752 is no.
步驟S754:快速位元率-失真最佳化電路214使用該目標子編碼區塊左下方的相鄰塊的原始像素Src進行預測。請參考步驟S726的說明。舉例來說,對子編碼區塊bs(3,3)(或子編碼區塊bs(4,3))的子編碼區塊bs16_2而言,因為其左下方的相對應的子編碼區塊(即,相鄰塊)是子編碼區塊bs(4,2) (或編碼區塊B(3,1))的一部分,而子編碼區塊bs(4,2)(或編碼區塊B(3,1))尚未完成(或尚未開始)第二階段的操作,所以此時快速位元率-失真最佳化電路214改為使用相鄰塊的原始像素Src進行預測。 Step S754: The fast bit rate-distortion optimization circuit 214 uses the original pixel Src of the neighboring block at the lower left of the target sub-coding block for prediction. Please refer to the description of step S726. For example, for the sub-coding block bs16_2 of the sub-coding block bs(3,3) (or the sub-coding block bs(4,3)), since the corresponding sub-coding block (i.e., the adjacent block) at the lower left is part of the sub-coding block bs(4,2) (or the coding block B(3,1)), and the sub-coding block bs(4,2) (or the coding block B(3,1)) has not yet completed (or started) the second stage operation, the fast bit rate-distortion optimization circuit 214 now uses the original pixel Src of the adjacent block for prediction.
步驟S756:快速位元率-失真最佳化電路214使用該目標子編碼區塊左下方的相鄰塊的重建像素Rec進行預測。請參考步驟S724的說明。舉例來說,因為當快速位元率-失真最佳化電路214處理子編碼區塊bs(3,3)(或子編碼區塊bs(4,3))的子編碼區塊bs16_0時,其左下方的對應的子編碼區塊(即,相鄰塊)是子編碼區塊bs(3,2)(或子編碼區塊bs(4,2))的一部分,而且子編碼區塊bs(3,2)(或子編碼區塊bs(4,2))的第二階段操作已完成,所以快速位元率-失真最佳化電路214可以使用該相鄰塊的重建像素Rec進行預測。 Step S756: The fast bit rate-distortion optimization circuit 214 uses the reconstructed pixels Rec of the neighboring block at the lower left of the target sub-coding block for prediction. Please refer to the description of step S724. For example, when the fast bit rate-distortion optimization circuit 214 processes the sub-coding block bs16_0 of the sub-coding block bs(3,3) (or the sub-coding block bs(4,3)), the corresponding sub-coding block to the lower left (i.e., the neighboring block) is part of the sub-coding block bs(3,2) (or the sub-coding block bs(4,2)), and the second stage operation of the sub-coding block bs(3,2) (or the sub-coding block bs(4,2)) has been completed, so the fast bit rate-distortion optimization circuit 214 can use the reconstructed pixel Rec of the neighboring block for prediction.
綜上所述,快速位元率-失真最佳化電路214可以根據預測方向及目標子編碼區塊與目標編碼區塊之間的相對位置決定使用重建像素Rec或原始像素Src來進行預測。相較於習知技術只使用原始像素Src進行預測,本發明可以提升預測的速度及準確度。 In summary, the fast bit rate-distortion optimization circuit 214 can determine whether to use the reconstructed pixel Rec or the original pixel Src for prediction according to the prediction direction and the relative position between the target sub-coding block and the target coding block. Compared with the conventional technology that only uses the original pixel Src for prediction, the present invention can improve the speed and accuracy of prediction.
請參閱圖8,圖8是本發明第一最佳化操作之另一實施例的部分流程圖。圖7A至圖7E的流程可以歸納成圖8的流程。圖8的流程包含以下步驟。 Please refer to Figure 8, which is a partial flow chart of another embodiment of the first optimization operation of the present invention. The processes of Figures 7A to 7E can be summarized into the process of Figure 8. The process of Figure 8 includes the following steps.
步驟S810:快速位元率-失真最佳化電路214從一個目標編碼區塊的複數個子編碼區塊中決定一目標子編碼區塊。請參考步驟S710的說明。 Step S810: The fast bit rate-distortion optimization circuit 214 determines a target sub-coding block from a plurality of sub-coding blocks of a target coding block. Please refer to the description of step S710.
步驟S820:快速位元率-失真最佳化電路214判斷在預測方向上對應於該目標子編碼區塊之一參考子編碼區塊(例如,目標子編碼區塊在預測方向上的相鄰塊)的重建像素是否已產生(即,判斷記憶體122中是否已儲存 該參考子編碼區塊的重建像素)。舉例來說,請參閱圖3,當目標子編碼區塊是子編碼區塊bs(4,3)(或子編碼區塊bs(4,4))而預測方向是上方時,子編碼區塊bs(4,3)(或子編碼區塊bs(4,4))在預測方向上的相鄰塊是子編碼區塊bs(3,3)(或子編碼區塊bs(3,4))。步驟S820的結果為是對應到步驟S720、步驟S722、步驟S730及步驟S740的結果為是,以及對應到步驟S736及步驟S752的結果為否。步驟S820的結果為否對應到步驟S722、步驟S734、步驟S740及步驟S750的結果為否,以及對應到步驟S736及步驟S752的結果為是。 Step S820: The fast bit rate-distortion optimization circuit 214 determines whether a reconstructed pixel corresponding to a reference sub-coding block in the prediction direction (e.g., a neighboring block of the target sub-coding block in the prediction direction) has been generated (i.e., determines whether the reconstructed pixel of the reference sub-coding block has been stored in the memory 122). For example, referring to FIG. 3 , when the target sub-coding block is sub-coding block bs(4,3) (or sub-coding block bs(4,4)) and the prediction direction is upward, the neighboring block of sub-coding block bs(4,3) (or sub-coding block bs(4,4)) in the prediction direction is sub-coding block bs(3,3) (or sub-coding block bs(3,4)). The result of step S820 is yes, which corresponds to the results of step S720, step S722, step S730 and step S740 being yes, and the results of step S736 and step S752 being no. The result of step S820 is no, which corresponds to the results of step S722, step S734, step S740 and step S750 being no, and the results of step S736 and step S752 being yes.
步驟S830:快速位元率-失真最佳化電路214使用相鄰塊的重建像素Rec進行預測。請參考步驟S724、步驟S732、步驟S742或步驟S756的說明。 Step S830: The fast bit rate-distortion optimization circuit 214 uses the reconstructed pixels Rec of the adjacent blocks for prediction. Please refer to the description of step S724, step S732, step S742 or step S756.
步驟S840:快速位元率-失真最佳化電路214使用相鄰塊的原始像素Src進行預測。請參考步驟S726、步驟S738、步驟S744或步驟S754的說明。 Step S840: The fast bit rate-distortion optimization circuit 214 uses the original pixel Src of the adjacent block for prediction. Please refer to the description of step S726, step S738, step S744 or step S754.
前揭實施例雖以64*64像素的編碼區塊為例,然此並非對本發明之限制,本技術領域人士可依本發明之揭露適當地將本發明應用於其它尺寸的編碼區塊。 Although the above-mentioned embodiment takes a 64*64 pixel coding block as an example, this is not a limitation of the present invention. People skilled in the art can appropriately apply the present invention to coding blocks of other sizes according to the disclosure of the present invention.
雖然本發明之實施例如上所述,然而該些實施例並非用來限定本發明,本技術領域具有通常知識者可根據本發明之明示或隱含之內容對本發明之技術特徵施以變化,凡此種種變化均可能屬於本發明所尋求之專利保護範疇,換言之,本發明之專利保護範圍須視本說明書之申請專利範圍所界定者為準。 Although the embodiments of the present invention are described above, these embodiments are not intended to limit the present invention. Those with ordinary knowledge in the technical field may make changes to the technical features of the present invention based on the explicit or implicit content of the present invention. All these changes may fall within the scope of patent protection sought by the present invention. In other words, the scope of patent protection of the present invention shall be subject to the scope of the patent application defined in this specification.
S810,S820,S830,S840:步驟 S810, S820, S830, S840: Steps
Claims (12)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW112131979A TWI869992B (en) | 2023-08-24 | 2023-08-24 | Video encoder and video encoding method |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| TW112131979A TWI869992B (en) | 2023-08-24 | 2023-08-24 | Video encoder and video encoding method |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| TWI869992B true TWI869992B (en) | 2025-01-11 |
| TW202510580A TW202510580A (en) | 2025-03-01 |
Family
ID=95151696
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| TW112131979A TWI869992B (en) | 2023-08-24 | 2023-08-24 | Video encoder and video encoding method |
Country Status (1)
| Country | Link |
|---|---|
| TW (1) | TWI869992B (en) |
Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20070009026A1 (en) * | 2005-07-07 | 2007-01-11 | Do-Kyoung Kwon | Methods and systems for rate control in video encoder |
| US20130121401A1 (en) * | 2011-11-16 | 2013-05-16 | Alexander Zheludkov | Video compression for high efficiency video coding |
| WO2020207492A1 (en) * | 2019-04-12 | 2020-10-15 | Beijing Bytedance Network Technology Co., Ltd. | Interaction between matrix-based intra prediction and other coding tools |
-
2023
- 2023-08-24 TW TW112131979A patent/TWI869992B/en active
Patent Citations (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20070009026A1 (en) * | 2005-07-07 | 2007-01-11 | Do-Kyoung Kwon | Methods and systems for rate control in video encoder |
| US20130121401A1 (en) * | 2011-11-16 | 2013-05-16 | Alexander Zheludkov | Video compression for high efficiency video coding |
| WO2020207492A1 (en) * | 2019-04-12 | 2020-10-15 | Beijing Bytedance Network Technology Co., Ltd. | Interaction between matrix-based intra prediction and other coding tools |
Also Published As
| Publication number | Publication date |
|---|---|
| TW202510580A (en) | 2025-03-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN110087087B (en) | VVC inter-frame coding unit prediction mode early decision and block division early termination method | |
| JP6978944B2 (en) | Video coding method, video decoding method, coding device and decoding device | |
| US12301798B2 (en) | Method, codec device for intra frame and inter frame joint prediction | |
| TW201246946A (en) | Image predict coding method, image predict coding device, image predict coding program, image predict decoding method, image predict decoding device, and image predict decoding program | |
| CN102282851B (en) | Image processing device, decoding method, intra-frame decoder, intra-frame decoding method, and intra-frame encoder | |
| JP2012514429A (en) | Multiple candidate motion estimation with progressive spatial filtering of differential motion vectors | |
| CN106375764B (en) | A kind of bonding position prediction and block replicate the video intra-frame encoding method of prediction | |
| US20150172687A1 (en) | Multiple-candidate motion estimation with advanced spatial filtering of differential motion vectors | |
| CN112104868B (en) | Quick decision-making method for VVC intra-frame coding unit division | |
| US11968376B2 (en) | Reference image encoding method, reference image decoding method, reference image encoding device, and reference image decoding device | |
| WO2015010319A1 (en) | P frame-based multi-hypothesis motion compensation encoding method | |
| CN111131837B (en) | Motion compensation correction method, encoding method, encoder, and storage medium | |
| CN103024378A (en) | Motion information exporting method and device in video coding and decoding | |
| CN107396102A (en) | A kind of inter-frame mode fast selecting method and device based on Merge technological movement vectors | |
| CN110392265B (en) | Inter-frame motion estimation method and device, electronic equipment and readable storage medium | |
| JP2016027697A (en) | Method and device for determining set of modifiable elements in group of pictures | |
| CN109922347A (en) | Video coding and decoding method and its image processing apparatus | |
| CN102215392B (en) | Intra-frame predicting method or device for estimating pixel value | |
| TWI559748B (en) | Method and system for extending prediction modes and performance of video codecs | |
| TWI869992B (en) | Video encoder and video encoding method | |
| CN101588487A (en) | Video intraframe predictive coding method | |
| CN112954365A (en) | HEVC interframe motion estimation pixel search improvement method | |
| WO2023049219A1 (en) | Candidate derivation for affine merge mode in video coding | |
| JP5016561B2 (en) | Moving picture encoding apparatus, moving picture decoding apparatus, moving picture encoding method, and moving picture decoding method | |
| CN117176957A (en) | Video encoder and video encoding method |