TWI221742B - Quantization matrix adjusting method for quality improvement - Google Patents
Quantization matrix adjusting method for quality improvement Download PDFInfo
- Publication number
- TWI221742B TWI221742B TW92112855A TW92112855A TWI221742B TW I221742 B TWI221742 B TW I221742B TW 92112855 A TW92112855 A TW 92112855A TW 92112855 A TW92112855 A TW 92112855A TW I221742 B TWI221742 B TW I221742B
- Authority
- TW
- Taiwan
- Prior art keywords
- quantization
- adjustment
- image
- scale factor
- matrix
- Prior art date
Links
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
Description
1221742 1 號 92112855 五、發明說明(1) 一、【發明所屬之技術領域】 本發明係關於改善影像品質的量化矩陣調整方法,特 別是關於利用縮小量化矩陣來改善影像品質的量化矩陣調 整方法。 二、【先前技術】 為了縮小影像資料量,一般會對影像進行壓縮,例如 MPEG格式之影像編碼(c〇ding)。影像編碼之基本單元 (basic unit)為巨集區塊(macro — bi〇ck)。若取樣 (samp 1 ing)為4 : 2 : 0格式’則每個巨集區塊具有6個區塊 (block) ’分別為4個Y區塊、一個cb區塊、以及一個Cr區 塊。母個區塊必須先經過離散餘弦轉換(d i s c r e丨e c 〇 s i n e transform,以下簡稱DCT)後,再將DCT係數 (coefficient)量化成整數(integer)。一種雜齒形 (zigzag)掃描或其他替代之掃描方法被用來將二維(tw〇一 dimension)之量化係數陣列排列成一維(one — dimensi〇n) 資料。最後,再利用所謂可變長度編碼(variable-length coding ’以下簡稱VLC)進行熵編碼(entropy coding)。 通常,DCT係數F[v] [u]的量化可表示成: QF[v][u] = 16 * F[v][u] / (Q * w[v][u])…(1) 其中,v、U為二維陣列之指標(index),範圍從0〜 7。Q為每個巨集區塊内之各區塊的量化比例因子 (quantizer scale),可隨著不同之巨集區塊改變。W[v] [u]為整張圖像(picture)所定義之量化矩陣 (quantization matrix),用來指定每個不同DCT係數之權1221742 No. 1 92112855 V. Description of the invention (1) [Technical field to which the invention belongs] The present invention relates to a quantization matrix adjustment method for improving image quality, and particularly to a quantization matrix adjustment method for reducing image quality by using a reduced quantization matrix. 2. [Previous Technology] In order to reduce the amount of image data, the image is generally compressed, such as MPEG-based image coding (coding). The basic unit of image coding is a macro-block. If the sampling is 4: 2: 0 format, then each macro block has 6 blocks, which are 4 Y blocks, one cb block, and one Cr block. The parent blocks must first undergo a discrete cosine transform (d i s c r e 丨 e c 〇 s in e transform, hereinafter referred to as DCT), and then the DCT coefficients (coefficient) are quantized into integers. A zigzag scan or other alternative scanning method is used to arrange a two-dimensional (tw〇1 dimension) quantization coefficient array into one-dimensional (menu-dimensi) data. Finally, the so-called variable-length coding (hereinafter referred to as VLC) is used for entropy coding. In general, the quantization of the DCT coefficients F [v] [u] can be expressed as: QF [v] [u] = 16 * F [v] [u] / (Q * w [v] [u]) ... (1) Among them, v, U are indexes of the two-dimensional array, ranging from 0 to 7. Q is the quantizer scale of each block in each macro block, which can be changed with different macro blocks. W [v] [u] is the quantization matrix defined by the entire picture, which is used to specify the weight of each different DCT coefficient
1221742 _案號92112855_年月日____ 五、發明說明(2) 值(weighting factor)。圖1顯示在MPEG - 2規格中對内部 區塊(intra block)所定義的預設量化矩陣。如圖1之量化 矩陣所示,該量化矩陣的值隨著陣列指標v、u的增加而逐 漸變大。此特性使得具有高頻之量化係數較易變成〇,原 因是人類的眼睛對於低頻信號較敏感,而對高頻信號較不 敏感。 另外,反量化(inverse-quantization)被使用於回復 (recover) DCT係數。通常量化之DCT係數QF[v] [u]的反量 化被定義為:1221742 _ case number 92112855_ year month day ____ 5. Description of the invention (2) Weighting factor. Figure 1 shows the preset quantization matrix defined for the intra block in the MPEG-2 specification. As shown in the quantization matrix of Fig. 1, the value of the quantization matrix gradually increases as the array indices v, u increase. This characteristic makes quantization coefficients with high frequencies easier to become 0, because human eyes are more sensitive to low-frequency signals and less sensitive to high-frequency signals. In addition, inverse-quantization is used to recover DCT coefficients. The inverse quantization of the commonly quantized DCT coefficients QF [v] [u] is defined as:
F’[v][u] = QF[v][u] * Q * W[v][u] / 16 …(2) 其中F’[v][u]為回復之DCT係數。原始之DCT係數F [v] [u]與回復之DCT係數F’ [v][u]的差值被稱為量化誤差 (quantization error),且被定義為: E[v] [u] = F[v][u] - F’ [v][u] …(3)F ’[v] [u] = QF [v] [u] * Q * W [v] [u] / 16… (2) where F’ [v] [u] is the DCT coefficient of the reply. The difference between the original DCT coefficient F [v] [u] and the returned DCT coefficient F '[v] [u] is called the quantization error and is defined as: E [v] [u] = F [v] [u]-F '[v] [u]… (3)
而量化比例因子Q被用於調整量化矩陣w [ v ] [ u ]之内容 的比例值,Q值的範圍係從1〜31。應用於MPEG-1與MPEG-2 之可適應性量化(adaptive quantization)可隨意變化每 個巨集區塊之Q值,但於MPEG-4時僅能些微(slightly)調 整相鄰巨集區塊的Q值。而且,MPEG-2具有將量化比例因 子從(1〜3 1 )對應到從(0 · 5〜5 6 )之非線性之實際量化比例因 子。 調整量化比例因子Q可以控制巨集區塊之位元消耗 (bit consumption)以及編碼品質(coded quality)。對於 較大之Q值會使量化DCT係數變小,而造成更多之量化])ct 係數為0。因此’經過VL C處理後的編碼位元流(c〇d ed b i tThe quantization scale factor Q is used to adjust the content of the quantization matrix w [v] [u]. The Q value ranges from 1 to 31. The adaptive quantization applied to MPEG-1 and MPEG-2 can randomly change the Q value of each macro block, but in MPEG-4, it can only slightly adjust adjacent macro blocks. Q value. Furthermore, MPEG-2 has an actual quantization scale factor that corresponds to a non-linearity from (1 to 3 1) to (0 · 5 to 5 6). Adjusting the quantization scale factor Q can control the bit consumption and coded quality of the macro block. For a larger Q value, the quantized DCT coefficient becomes smaller, resulting in more quantization]) The ct coefficient is 0. Therefore, the coded bit stream (c〇d ed b i t
第8頁 1221742 案號 92112855 五、發明說明(3) stream)會變短。然而,結果會造成量化誤差變大,造成 解碼後之影像品質變差。若我們希望得到較好的影像品 質,則必須設定較小的Q值以降低量化誤差,但是編碼位 元流會變長。 在一般的應用中,MPEG位元流的位元率(bi t —rate)是 受到限制的(con s t ra i ne d)。例如,在數位影音光碟 (Digital Versatile Disk,DVD)的標準中即定義mpeg-2 視訊流(video stream)的位元率不可高於每秒98Mb,所 以在編碼過程中必須控制位元消耗來滿足該項限制。Page 8 1221742 Case No. 92112855 Fifth, the description of the invention (3) stream) will become shorter. However, as a result, the quantization error becomes larger, resulting in poorer image quality after decoding. If we want to get better image quality, we must set a smaller Q value to reduce the quantization error, but the encoding bit stream will become longer. In general applications, the bit rate (bit-rate) of the MPEG bit stream is limited (con s t ra i ne d). For example, in the Digital Versatile Disk (DVD) standard, it is defined that the bit rate of the mpeg-2 video stream (video stream) cannot be higher than 98Mb per second, so the bit consumption must be controlled during the encoding process to meet This restriction.
在一連串視訊晝面中的每張圖像的内容均有變化,且 編碼之複雜度(complexi ty)在每個部分亦不盡相同。使用 於MPEG-1之視訊緩衝核驗器(video buffer verifier,以 下簡稱VBV)對於不同圖像雖多少有提供位元率消耗之通融 性(f lexibi 1 ity),但長時間之整體位元率仍為固定位元 率(constant bit rate,以下簡稱CBR)。而 MPEG-2 引進了The content of each image in a series of video diurnal changes, and the complexity of the encoding (complexi ty) varies from part to part. The video buffer verifier (hereinafter referred to as VBV) used in MPEG-1 provides the bit rate consumption flexibility (f lexibi 1 ity) for different images, but the overall bit rate for a long time is still Is a constant bit rate (constant bit rate, hereinafter referred to as CBR). And MPEG-2 introduced
可變位元率(variable bit rate,以下簡稱VBR)操作模 式’提供了每張圖像位元率消耗之變化更大通融性。v BV 緩衝器被用來模仿(emulate)MPEG解碼器之輸入緩衝器, 且由MPEG編碼器產生之位元流不可違反(violate)vBV緩 衝器之限制,否則位元流將無法適當地被解碼。圖2顯示 V B V緩衝器在c B R插作模式之示意圖。如該圖所示,斜線部 分係表示以固定位元率輸入緩衝器之編碼資料,而垂直線 部分係表示從緩衝器瞬間移出之被解碼圖像的資料。 為了使位元流滿足MPEG位元控制的要求,當解石馬器要 解石馬屠1德,国你ΛΑ次、丨,、丨、,1 M wu _ .The variable bit rate (VBR) operation mode 'provides greater flexibility in the variation of the bit rate consumption of each image. v The BV buffer is used to emulate the input buffer of the MPEG decoder, and the bit stream generated by the MPEG encoder must not violate the restrictions of the vBV buffer, otherwise the bit stream cannot be decoded properly . Figure 2 shows a schematic diagram of the V B V buffer in c B R interpolation mode. As shown in the figure, the oblique line portion represents the encoded data input to the buffer at a fixed bit rate, and the vertical line portion represents the data of the decoded image that is momentarily removed from the buffer. In order to make the bit stream meet the requirements of MPEG bit control, when the calculus horse implement needs to solve the calculus horse, you need ΛΑ times, 丨 ,, 丨 ,, 1 M wu _.
第9頁 1221742 五、發明說明(4) 碼器之緩衝器不可過滿(overfill)。參考圖2,若一張圖 像消耗太多位元,則VBV緩衝器或許會資料不足 (underflow),因此可分配位元(all〇catable Mts)的上 限(upper bound)為UB。相同的,若一張圖像消耗太少位 元’則VBV緩衝器或許會資料溢流(〇ver|:i〇w),因此可分 配位元一(311〇〇3饨13 16 1)“3)的下限(1〇^1*1)01111(1)為1^。 圖3顯不VBV缓衝器在VBR操作模式之示意圖。VBR與CBR操 作模式之差異性是VBR操作模式是以指定的最大位元率輸 入VBV緩衝_器直到VBV緩衝器滿載為止,因此VBR操作模式 的平均位疋率輸入率是可變的。所以,VBR沒有最少位元 之限制’只有可分配最大位元的限制。 為了滿足VBV的限制,編竭器必須對每張圖像分配一 ==算=budget),之後試著控制實際的消耗位 buff 兀异值。一般是利用虛擬緩衝機制(virtual buiier mechamsm)來控制位元消耗。 於0時,則將量化比例因子Q對 ^ 二 里- 古私一日日k w τ應馬1 ,而當緩衝器佔有量 2 ; 一門檻值R( threshold)時,則將量化比 為31。門檻值R—般被稱為反應因子(⑽以 子0對應 在對一張圖像編碼之前,虛擬緩衝 ctor)。 初始之量化比例因子Q為二 ::器即利用該量化比例因子㈣ q / 3」: 化並編i —個巨#區塊所消 集^^進仃篁 預算值’則虛擬緩衝器佔有則増加位二里:·大於平均位元 有量D減少。若虛擬缓衝器伯有虛擬緩衝器佔 _狀况思味者位元消 第10頁 1221742Page 9 1221742 V. Description of the invention (4) The buffer of the encoder must not be overfilled. Referring to FIG. 2, if an image consumes too many bits, the VBV buffer may be underflowed. Therefore, the upper bound of allocable Mts is UB. Similarly, if an image consumes too few bits, the VBV buffer may overflow the data (〇ver |: i〇w), so bit one (311〇03 饨 13 16 1) can be allocated " 3) The lower limit (1〇 ^ 1 * 1) 01111 (1) is 1 ^. Figure 3 shows the schematic diagram of VBV buffer in VBR operation mode. The difference between VBR and CBR operation modes is that VBR operation mode is specified The maximum bit rate is input to the VBV buffer until the VBV buffer is fully loaded, so the average bit rate input rate of the VBR operating mode is variable. Therefore, VBR has no minimum bit limit. Limitation. In order to meet the limitation of VBV, the editor must assign one image to each image, and then try to control the actual consumption bit buff. The virtual buffer mechanism (virtual buiier mechamsm) is generally used. To control the bit consumption. At 0, the quantization scale factor Q is set to ^ Erli-Ancient private day kw τ should be 1 and when the buffer occupies 2; a threshold R (threshold), then The quantization ratio is 31. The threshold R is generally called the response factor Before the code, virtual buffer ctor). The initial quantization scale factor Q is two :: The device uses this quantization scale factor ㈣ q / 3 ": to combine and edit i — a giant #block elimination set ^^ into the budget If the value is', the virtual buffer occupancy is increased by two miles: · The amount D greater than the average bit is reduced. If there is a virtual buffer in the virtual buffer, the _status thinker bit page 1212742
,里超過^多’所以增加量化比例因子Q來試圖減少位元 /肖耗率。右虛擬緩衝器佔有量1)減少低於4〇 — R/3i, 量化比例因子QΛ ^ 将 卞4 β又疋成qO - 1。此狀況意味著位元消耗量 低於預期值’戶斤以減少量化比例因子Q來試圖增加位 定虛 可視 於一 的較 得每 碼器 後。 衝器 重問 則會 範圍 視訊 變的 即使 致於 率。 分的 須選 使用虛,緩衝機制來控制位元消耗的問題是要如何指 擬緩Ϊ器初始佔有量d0。該虛擬緩衝器初始佔有量do 為目前圖片之編碼複雜度的估測值(esti mat ion)。對 ,固疋的位π預算值而言,若目前圖像之複雜度相對 ^則必眉選擇較咼之虛擬緩衝器初始佔有量d 0,伟 塊之量化比例因子Q相對的提高。但是,編吏 二:ίί目前圖像之複雜度直到該圖像被實際編碼 你右旦》。、t式Ϊ繼承(inherit)前一張圖像之虛擬緩 :::種:單方式可處理大部分狀況而不會 造成VBV資料不足。 W ΙΉ改支時’ ,個^集區塊之量化比例因子Q的範圍是從】糾 :以”視訊編碼之大部分狀況。然而,t 一連串2 非ΐ目標位元率很高時’則量化比例因子备 量:’比例因早。更多的位元。#至當視訊真的太單純: 二化比例被設定成丨都無法產 需要增加填補位元(stuffing bits),而位元从 化比例因子Av“為丨·5時,對於大部In order to reduce the bit / shaw consumption rate, the quantization scale factor Q is increased. The right virtual buffer occupancy 1) is reduced below 40-R / 3i, and the quantization scale factor QΛ ^ will 卞 4 β into qO-1 again. This condition means that the bit consumption is lower than the expected value 'to reduce the quantization scale factor Q in an attempt to increase the position of the virtual gain per unit. If you ask again, the range of the video will change even if it is caused by the rate. The question of how to use the virtual and buffering mechanism to control bit consumption is how to refer to the initial buffer occupancy d0. The initial buffer occupation amount do is an estimated value of the coding complexity of the current picture. Regarding the fixed π budget value, if the complexity of the current image is relatively high, it is necessary to select a relatively large initial buffer occupancy d 0, and the quantization scale factor Q of the block is relatively increased. However, editor 2: The complexity of the current image until the image is actually encoded. , T-type inheritance (inherit) the virtual ease of the previous image ::: kind: a single method can handle most situations without causing insufficient VBV data. When W 支 is changed, the range of the quantization scale factor Q for each set of blocks is from [correction: "most of the state of video coding. However, when a series of 2 non-ΐ target bit rates are high, 'quantization' Scale factor reserve: 'The scale is early. More bits. # To when the video is really too simple: the dimorphization ratio is set to 丨 both can not be produced, you need to increase the stuffing bits, and the bit compliance ratio When the factor “Av” is 丨 · 5, for most
則或;^=:=:為15,但是卻必 --里化比例因子的值變的越小,其解 1221742 1?虎 92112855 五、發明說明(6) 析度亦變的越粗(coarser),結果造成量 地在1與2之間變化,使得影像的平挺 」/千陝迓 塊狀效應(b1〇cking artifact)。 域產生輕微可視之 三、【發明内容】 是提供一種可避免量 影像品質之量化矩陣 像品質的量 元量以及平 ;計算估測 化比例因子 斷是否進入 比例因子門 持為一般模 ’將預設之 調整模式時 式為一般模 化矩陣調 均量化比 量化比例 、以及位 調整模 楹值時, 式,調整 量化矩陣 ’根據縮 式時,根 之量化矩陣縮小,可 昇編碼後之影像品 視之塊狀效應。 有鑒於上述問題,本發明之目的 化比例因子解析度變粗,同時可提 調整方法。 為達成上述目的,本發明改善影 整方法包含下列步驟:更新已使用^ 例因子;對目前圖像指定位元預算值 因子,係根據已使用位元量、平均量 元預算值計算估測量化比例因子;判 式,當估測篁化比例因子小於一量化 則編碼模式設定為調整模式,'否則保 畺化矩陣,當編碼模式為調整模式曰夺 縮小;以及進行編碼,當編碼模式為 小後,量=矩陣進行編碼,當編碼模 據預設之量化矩陣進行編碼。 由於該發明在調整模式時將預設 避免估測量化比例因子太低, 質,並避免平坦影像區域產生;微可 四 實施方式 1221742Then, or ^ =: =: is 15, but it must be-the smaller the value of the scale factor becomes, the smaller the solution is 1221742 1? Tiger 92112855 V. Description of the invention (6) The coarser the resolution becomes (coarser ), Resulting in a quantitative change between 1 and 2, making the image flat and smooth "/ Qian Shaoyan block effect (b1ocking artifact). The domain is slightly visible. [Summary of the invention] is to provide a quantized matrix image quality that can avoid quantitative image quality. The adjustment mode is set to the general modulation matrix, the average quantization ratio, and the quantization ratio, and the bit to adjust the modulo value. When the adjustment quantization matrix is adjusted according to the reduction, the quantization matrix of the root is reduced, which can increase the encoded video product Depending on the block effect. In view of the above problems, the objective scale factor resolution of the present invention becomes coarse, and an adjustment method can be provided at the same time. In order to achieve the above object, the method for improving shading of the present invention includes the following steps: updating the used factor; and assigning a bit budget value factor to the current image, which is calculated based on the used bit amount and the average amount of the budget value. Scale factor; judgment formula, when the estimated scale factor is less than one quantization, the coding mode is set to the adjustment mode, 'otherwise the transformation matrix is preserved, when the coding mode is the adjustment mode, the scaling is reduced; and when the coding mode is small, After that, the quantity = matrix is used for encoding. When the encoding module is encoded according to a preset quantization matrix. Because the invention presets the adjustment measurement mode to avoid the measurement scale factor being too low, the quality and avoid the generation of flat image area;
陣調整方法。 y 當所計算之目前圖像的估測量化比例因子EstQ — C變的 =小,且目前圖像以預設之量化矩陣進行編碼時,平坦影 =區域會產生輕微可視之塊狀效應。為了解決此問題,本 、明之編碼器利用減少量化矩陣之權值(weight丨),藉 ^將估測量化比例因子EstQ_C調整成較大的值。例如,曰如 式(^)所示,當預設之量化矩陣W[v][u]縮小為1/4時,平 均量化比例因子Avg_Q可以從丨.5放大為6,此時量化比例 因子Q可以增加為7或8來減少位元率消耗,或降低為5或4 來增加位元率消耗。所以,相鄰之巨集區塊的量化誤差可 以大為降低。 /在MPEG-1與MPEG-2規格中,在每個編碼位元流的開頭 必須配置一串標頭(sequence header)資料,且該標頭可 被加入隨後的位元流。一旦解碼器接收到標頭資料,則量 化矩陣W[v] [u]會被設定成預設值。在MPEG — 丨甲,定製 (customized)的量化矩陣W[v][u]僅可在標頭中設定,且 該標頭僅可插入一圖像群組(Group 〇f pi ctures,以下簡 稱GOP)之前。此意味著當解碼器要變更量化矩陣時,解^ 器必須重新起始一個G0P,在G0P前插入一標頭資料,且在 標頭資料中配置新的量化矩陣。而在MPEG-2中,新的量化 矩陣不僅可以配置於標頭資料中,亦可插入一外延量化矩 陣。所以,若解碼器要變更量化矩陣時,必須在每張圖像 編碼之前。Array adjustment method. y When the calculated estimated scaling factor EstQ — C of the current image is changed to be small, and the current image is encoded with a preset quantization matrix, the flat shadow area will produce a slightly visible block effect. In order to solve this problem, the encoder of this and Ming uses the weight (quantity reduction) of the quantization matrix to reduce the estimated scaling factor EstQ_C to a larger value by ^. For example, as shown in formula (^), when the preset quantization matrix W [v] [u] is reduced to 1/4, the average quantization scale factor Avg_Q can be enlarged from 丨 .5 to 6, at this time the quantization scale factor Q can be increased to 7 or 8 to reduce bit rate consumption, or 5 or 4 to increase bit rate consumption. Therefore, the quantization error of adjacent macroblocks can be greatly reduced. / In the MPEG-1 and MPEG-2 specifications, a sequence of header information must be placed at the beginning of each encoded bitstream, and this header can be added to subsequent bitstreams. Once the decoder receives the header data, the quantization matrix W [v] [u] is set to the default value. In MPEG — A, a customized quantization matrix W [v] [u] can only be set in the header, and the header can only be inserted into a group of images (Group 〇 ctures, hereinafter referred to as GOP). This means that when the decoder wants to change the quantization matrix, the decoder must restart a G0P, insert a header data before G0P, and configure a new quantization matrix in the header data. In MPEG-2, the new quantization matrix can not only be placed in the header data, but also an epitaxial quantization matrix can be inserted. Therefore, if the decoder wants to change the quantization matrix, it must be before each picture is encoded.
第13頁 1221742 年Page 13 1221742
案號 921128!^ 五、發明說明(8) 圖像事先分析即進行目前圖像之編碼動作。由扒s ^ 有事先掃描分析圖像之複雜度即對圖像進行編、、扁,為沒 知TEST模型5(teSt model 5,TM5)位元率控制演^就像習 (rate control a 1 g〇ri thm),編碼器只能利用於鼻法 圖像來預估目前圖像之複雜度。該第一實施例:二張編碼 下: )步驟如 步驟S40 2 :更新已使用位元量ΒΒ—χ以及平旦 因子Avg一Q。在一張X圖像(X可為];圖像、ρ圖像或β = 編碼之後,編碼器即取得該X圖像之平均量化比 像)被Case No. 921128! ^ V. Description of the invention (8) The image is analyzed in advance to perform the encoding operation of the current image. The complexity of the image is analyzed by scanning in advance, that is, the image is edited, flattened, and it is unknown that the TEST model 5 (teSt model 5, TM5) bit rate control exercise is like rate control a 1 g〇ri thm), the encoder can only use the nose image to estimate the complexity of the current image. In the first embodiment: two encoding steps: Steps are as follows: Step S40 2: Update the used bit quantity BB-χ and the pingdan factor Avg-Q. After an X image (X can be]; image, ρ image, or β = encoding, the encoder obtains the average quantized image of the X image.
Avg一Q '最後虛擬緩衝器佔有量乜乂、以 知因子 BB —X。 匕使用位元量 步驟S4 0 4 ··對目前圖像指定位元預算值ββ。。 凡 狀況下,下一張圖像之初始虛擬緩衝器佔有量己 在、, 定成最後虛擬緩衝器佔有量d_X,且初始量化比^會被設 被設定成平均量化比例因子AVg-Q。而且,由圖^因子會 率往制(frame-level rate control)來指定目4日位元 元預算值BB-C。 “疋目別圖像之位 步驟S40 6 :計算估測量化比例因子“以^。 一 格式之相鄰圖像其活動程度大致相同,因此嗲°由於相同 刖一張圖像之已使用位元量BB一X、目前圖像之 」用 BB一C、以及平均量化比例因子A q來計算 70預算值 測量化比例因他tQ_c : — 像之估Avg_Q 'Finally the virtual buffer occupancy is 乜 乂, and the factor BB —X is known. Use a bit amount Step S4 0 4 ·· Specify a bit budget value ββ for the current image. . In all cases, the initial virtual buffer occupancy of the next image is already set as the final virtual buffer occupancy d_X, and the initial quantization ratio ^ is set to be the average quantization scale factor AVg-Q. Furthermore, the budget value BB-C for the 4th bit is specified by the frame-level rate control. "Eye position of the image step S40 6: Calculate the estimated scale factor" by ^. Adjacent images of a format have roughly the same degree of activity, so because of the same used bit amount BB-X for one image, BB-C for the current image, and average quantization scale factor A q To calculate the measured ratio of 70 budget values due to his tQ_c: — like the estimate
EstQ—C = (BB一X/BB—C) * Avg一Q."(4) 步驟S40 8 :偵測是否進入調整模式。當估 因子EstQ — C小於一比例因子門檻值ThQ X時,你丨^化比例 _二了 一例如ThQ一X為 第14頁 1221742EstQ-C = (BB-X / BB-C) * Avg-Q. (4) Step S40 8: Detect whether to enter the adjustment mode. When the estimation factor EstQ — C is less than a threshold of the scale factor ThQ X, you will reduce the ratio _ two. For example, ThQ-X is page 14 1221742
s、3或4,表示該視訊之圖像内容對於所給的位元率而言 疋,當單純的。若上一張編碼圖像之已使用位元量BB_X以 及指定給目前圖像之位元預算值BB__C大致相等,則可猜測 以指定給目前圖像之位元預算值BB — C將造成估測量化比例 * 因子Es tQ—C太小。因此,當估測量化比例因子EstQ —c小於 , 比例因子門播時,則編碼器進入步驟S4 1 0的調整 模式,否則以步驟S416的一般模式處理。 ^ 、步驟S41 0 ··縮小量化矩陣成為新的量化矩陣。在調整 模^中’編碼器會希望將目前圖像之最後平均量化比例因 ,提升到一個安全值SQ —X,而該安全值SQ —χ可能會大於或 φ 等於比例因子門檻值ThQ_x。因此,本發明係將利用一調 整因子(adjustment factor)S來縮小預設之量化矩陣,且 初始虛擬緩衝器佔有量會被提昇成d0 — x/s。該調整因子s 為一個小於1的數值,且可由下式計算: S = EstQ一C / SQ一X …(5) 而新的量化矩陣W,[v] [u]為: W’ [v] [u] = W0[v] [u] * s …(6) 其中v與11為0〜7的指標。W0[ v] [u]可為預設之量化矩 陣或為使用者定義之量化矩陣。因此,安全值⑽一乂越大, 調整因子S就會越小,例如安全值SQ —χ為6。由於量化矩陣 的最小值為1,因此W,[v][u]之内容的最小值被限制為j。 另外,編碼器中會使用兩個量化矩陣,一個是給内部 (intra)區塊使用,而另一個是給互相關聯(inter)區塊使 用。由於更新一個量化矩陣需要5丨2位元來編碼該量化矩 陣本身以及一些額外的位元,因此在位元s, 3, or 4 indicates that the image content of the video is 疋 for the given bit rate, when it is pure. If the used bit amount BB_X of the previous encoded image and the bit budget value BB__C assigned to the current image are approximately equal, it can be guessed that the bit budget value BB — C assigned to the current image will cause an estimation Quantization scale * The factor Es tQ-C is too small. Therefore, when the estimated scale factor EstQ —c is smaller than and the scale factor is gated, the encoder enters the adjustment mode of step S4 10, otherwise it is processed in the general mode of step S416. ^ Step S41 0. The reduced quantization matrix becomes a new quantization matrix. In the adjustment mode ^, the encoder will hope to increase the final average quantization scale factor of the current image to a safe value SQ —X, and the safety value SQ —χ may be greater than or equal to the threshold of the scale factor ThQ_x. Therefore, the present invention will use an adjustment factor S to reduce the preset quantization matrix, and the initial virtual buffer occupancy will be increased to d0-x / s. The adjustment factor s is a value less than 1, and can be calculated by the following formula: S = EstQ-C / SQ-X… (5) and the new quantization matrix W, [v] [u] is: W '[v] [u] = W0 [v] [u] * s (6) where v and 11 are indices from 0 to 7. W0 [v] [u] can be a preset quantization matrix or a user-defined quantization matrix. Therefore, the larger the safety value is, the smaller the adjustment factor S is. For example, the safety value SQ —χ is 6. Since the minimum value of the quantization matrix is 1, the minimum value of the contents of W, [v] [u] is limited to j. In addition, two quantization matrices are used in the encoder, one for intra blocks and the other for inter blocks. Because updating a quantization matrix requires 5 丨 2 bits to encode the quantization matrix itself and some additional bits,
第15頁 1221742 案號 92112855Page 15 1221742 Case number 92112855
五、發明說明(1〇) 下,可儘量減少量化矩陣更新的數量。例如,丨 需要内部量化矩陣,而B圖像 ° 介乾陆《 Μ琢J此僅而要更新互相關聯量 t足夠。而對於P圖像而言,則要依據該圖像存在 門二估部編碼的巨集區&。若内部編碼的巨集區塊大於一 則必須更新内部量化矩陣與互相關聯量化矩陣, 、】/、需更新互相關聯量化矩陣即可。 行編^^S412 :以新的量化矩陣1’ [v][u]對目前之圖像進 ^驟S414 :檢查目前圖像是否編碼完成,若 成,則跳回步驟S4 02,若尚未完成則跳回步驟S41〇 :驟S4H :以預設的量化矩陣w[v][u] 進行編碼。 〜 步驟S418 :檢查目前圖像是否編碼完成,若編 成,則跳回步驟S4 02,若尚未完成則跳回步驟^1〇 : 70 在上述步驟中’若編碼之X圖像進入調整模式,直 化矩陣會縮小W/S倍,由於巨集區塊以新的量 = =’因此在計算平均量化比例因子Avg_Q時,亦 该4巨集區塊之Q值縮小丨/s倍以反映實際的編碼複、 再者,當對於相鄰圖像之調整因子3的差異夫、又 對每個圖像變更量化矩陣來反應該微小差昱’則 式。因此,可以在調整因子s的差異超過一的方 行量化矩陣的變更。另外,有一種解決方法是將調寺整才進 s預设;個範圍,並計算好其對應之量化矩陣。 調整因子SG可設UU、G.6 u、Q2等四個值如γ 應之量化矩陣分別為W1、W2、W3、W4 ^當調整因;s 刚二 _ _______7 ——_ 第16頁 1221742 案號 92112855V. Description of the invention Under (10), the number of quantization matrix updates can be minimized. For example, the internal quantization matrix is needed, and the B image is only necessary to update the correlation t. For P-pictures, there is a macro area & encoded by the gate's second estimation department according to the picture. If the internally encoded macroblock is larger than one, the internal quantization matrix and the interrelated quantization matrix must be updated, and the interrelated quantization matrix can be updated. Line editing ^^ S412: Use the new quantization matrix 1 '[v] [u] to perform step S414 on the current image. Check whether the current image is encoded. If it is, skip to step S4 02. If not, Then jump back to step S41. Step S4H: encode with a preset quantization matrix w [v] [u]. ~ Step S418: Check whether the current image is encoded. If it is edited, skip back to step S402. If it is not completed, skip back to step ^ 10: 70. In the above steps, 'If the encoded X image enters the adjustment mode, The matrix will be reduced by a factor of W / S. Since the macro block takes a new amount == ', when calculating the average quantization scale factor Avg_Q, the Q value of the 4 macro blocks is also reduced by 丨 / s times to reflect the actual Coding complex, and when the difference factor of the adjustment factor 3 of the adjacent image is changed, the quantization matrix is changed for each image to reflect the small difference. Therefore, the change of the quantization matrix can be performed in a case where the difference of the adjustment factors s exceeds one. In addition, there is a solution is to adjust the temple into the preset range, and calculate the corresponding quantization matrix. The adjustment factor SG can set four values such as UU, G.6 u, Q2, such as γ. The quantization matrices should be W1, W2, W3, and W4, respectively. ^ When the adjustment factor; s Gang Er _ _______7 —— _ Page 16 1221742 Number 92112855
五、發明說明(Π) 為0.67、0.62、0.54、0.61或0.58時,其更新之量化矩陣 均為W2 ’且只有第一張圖像需要將量化矩陣W2編碼到位元 流,其餘幾張圖像亦使用量化矩陣W 2直到標頭改變。 圖5顯不本發明改善影像品質的量化矩陣調整方法第 二實施例的流程圖。該實施例的流程是編碼器事先對目前 圖像分析後,再進行目前圖像之編碼動作。若編碼器可以 對圖像預先分析來收集複雜度估測之資訊,則該編^器$ 更正確地決定是否變更量化矩陣以及如何變更。一般而 言,目前圖像之複雜度可藉由進行動作估測(m〇ti〇nX es t i ma t i on )時來進行估測。對於I圖像而言,可以取得每 個内部編碼之巨集區塊的相異(var i ance)。對於p與^圖像 而言,必須根據内部編碼與互相關聯編碼模式之相異來進 行模式判斷(mode decision)。相異的總和一般被稱為目 前圖像之活動程度(activity)。在進行圖像編碼之前,編 碼器可以獲得該圖像之活動程度Act一C。而在圖像編碼之 後,平均量化比例因子Avg一Q以及實際使用位元ΒΒ〜χ可以 用來計算該圖像之複雜度。 ^ 當編碼器無法對圖像預先分析目前圖像時,編竭器只 =根據前一張解碼圖像來決定是否變更量化矩陣以及^ ^ 變更。、但是當相鄰兩張圖片的圖像内容有快速變化時,此 種方式的決定可能錯誤。例如,當前一張圖像之平均量化 比例因子Avg —Q僅稍低於比例因子門檻值ThQ一X時,目前 i將不t進入調整模式。然而,若目前圖像之編碼複雜^ 退=於前一張圖像之複雜度時,目前圖像編碼後之位元$ 將遠低元預算值,則位元率將過低。相反的,若前一 1221742 案號 92112855 年月曰 修正 五、發明說明(12) . 張圖像之複雜度相當低,但目前圖像之複雜度相當高,% 過於縮小之量化矩陣將造成影像品質大為衰減。 、 · 因此’第二實施例之方法與第一實施例之方法的差異 是該實施例預先估測目前圖像之活動程度Act —C後,再根、 ^ 據該活動程度Act —C進行估測量化比例因子EstQ — C之計 算。估測量化比例因子EstQ-C之計算如下式: ·V. Description of the invention (Π) When it is 0.67, 0.62, 0.54, 0.61 or 0.58, the updated quantization matrices are all W2 'and only the first image needs to be encoded into the bit stream, and the rest of the images The quantization matrix W 2 is also used until the header changes. FIG. 5 is a flowchart of a second embodiment of a quantization matrix adjustment method for improving image quality according to the present invention. The flow of this embodiment is that the encoder analyzes the current image in advance, and then performs the encoding operation of the current image. If the encoder can analyze the image in advance to collect the information of the complexity estimation, the encoder will more accurately decide whether to change the quantization matrix and how to change it. Generally speaking, the complexity of the current image can be estimated by performing motion estimation (m0ti ONX es t i ma t i on). For I-pictures, the var iance of each internally coded macroblock can be obtained. For p and ^ images, a mode decision must be made based on the difference between the internal coding and the interrelated coding modes. The sum of the differences is generally referred to as the activity of the current image. Before encoding the image, the encoder can obtain the degree of activity Act-C of the image. After the image is encoded, the average quantization scale factor Avg-Q and the actual bits BB ~ χ can be used to calculate the complexity of the image. ^ When the encoder cannot pre-analyze the current image of the image, the exhaustion device only decides whether to change the quantization matrix and change it according to the previous decoded image. , But when the image content of two adjacent pictures changes rapidly, the decision of this method may be wrong. For example, when the average quantization scale factor Avg —Q of the current image is only slightly lower than the scale factor threshold ThQ-X, i will not enter the adjustment mode at this time. However, if the encoding of the current image is complicated ^ Backward = At the complexity of the previous image, the bit $ after encoding the current image will be far lower than the budget value, and the bit rate will be too low. On the contrary, if the previous case No. 1221742 was revised in the fifth month, the invention description (12). The complexity of the image is quite low, but the complexity of the current image is quite high. The quality is greatly attenuated. Therefore, the difference between the method of the second embodiment and the method of the first embodiment is that this embodiment estimates the current activity level Act-C of the current image in advance, and then estimates based on the activity level Act-C Calculation of measured scale factor EstQ — C. The calculation of the estimated scale factor EstQ-C is as follows:
EstQ一C =(BB一X/BB一C)*Avg —Q*(Act —C/Act —X) ···(?) 其中,Act一X為前一張圖像之活動程度。式(7)與式 (4)的差異是式(7)在計算估測量化比例因子EstQ — C時,除 了考慮位元預算值、平均量化比例因子Avg一Q外,還同時' 考慮活動程度Ac t。亦即,當位元預算值與平均量化比例 _ 因子Avg一Q均相等的狀況下,若目前圖像的活動程度高於 前一張圖像之活動程度,則所計算出來的估測量化比例因 子E st Q一C會相對的提高,使目前圖像編碼後之位元率不备 超過位元預算值太多。相反的,若目前圖像的活動程度& 於前一張圖像之活動程度,則所計算出來的估測量化比例 因子EstQ一C會相對的降低,使目前圖像編碼後之位元 = 會低餘位元預算值太多。 不 當計算出估測量化比例因子EstQ — c後,第二實施例與 ,一實施例相同,均利用估測量化比例因子EstQ — c來判^ ^ 疋否進入調整模式。當估測量化比例因子EstQ — c小於比 , 因子門檻值ThQ — χ時,則進入調整模式,否則以一般楔^ ^ 處理。 、八《 田心八w I犋八伋螞器將預設之量化 f新的量化矩陣。在調整模式中,編碼器會希 挪一一 :·_·__________二 :-- 1將目前圖EstQ-C = (BB-X / BB-C) * Avg —Q * (Act —C / Act —X) ··· (?) Where Act-X is the activity level of the previous image. The difference between formula (7) and formula (4) is that in formula (7), when calculating the measured scale factor EstQ-C, in addition to considering the bit budget value and the average quantified scale factor Avg-Q, it also considers the degree of activity Ac t. That is, when the bit budget value and the average quantization ratio_factor Avg-Q are all equal, if the current image activity is higher than the previous image activity, the calculated estimated measurement ratio The factor E st Q-C will be relatively increased, so that the bit rate after the current image encoding is not ready to exceed the bit budget too much. Conversely, if the current image's activity level is & the previous image's activity level, the calculated estimated scaling factor EstQ-C will be relatively reduced, so that the bit after the current image encoding = There will be too little budget value. After the estimated measurable scale factor EstQ — c is calculated incorrectly, the second embodiment is the same as the first embodiment, and both use the estimated measurable scale factor EstQ — c to determine whether to enter the adjustment mode. When the estimated scale factor EstQ — c is smaller than the ratio and the factor threshold value ThQ — χ, the adjustment mode is entered, otherwise it is treated as a general wedge ^ ^. The eighth, "Tian Xinba," I 量化 汲 汲 蚂 将 will preset the quantization f new quantization matrix. In the adjustment mode, the encoder will move one by one: · _ · __________ two:-1
第18頁Page 18
1221742 修正 曰 五、發明說明(13) 像之最後平均量化比例因子提升到一個安全值Sq_x,而該 安全值SQ — X可能會大於或等於比例因子門檻值ThQ_x。因 此,本發明係將利用一調整因子(ad juss來 縮小預設之量化矩陣,且初值初始虛擬緩衝器佔有量會被 減少成dO X/S。該調整因;ς皂 , ^ ^ ^ n翌:u子3為—個小於1的數值,且可由 式(5)计异出來。而新的量化矩陣w 算出來。由於量化矩陣的事 Lv][ ] 了由式(6)叶 容的最小值被限制為j。 浐、為1,因此W,[ v ] [ u ]之内 不再重複說明。 〃績之動作與第一實施例相同, 以上雖以實施例說明本發明 之範圍,只要不 脫離本發明…但並不因此限定本發明 變形或變更。 要曰’該灯業者可進行各種 1221742 _案號92112855_年月曰 修正_ 圖式簡單說明 圖1顯示在MPEG-2規格中對内部區塊所定義的預設量 化矩陣。 圖2顯示VBV緩衝器在CBR操作模式之示意圖。 圖3顯示VBV緩衝器在VBR操作模式之示意圖。 圖4顯示本發明改善影像品質的量化矩陣調整方法第 一實施例的流程圖。 圖5顯示本發明改善影像品質的量化矩陣調整方法第 二貫施例的流程圖。1221742 Amendment V. Description of the invention (13) The final average quantization scale factor of the image is increased to a safe value Sq_x, and the safe value SQ — X may be greater than or equal to the threshold threshold value ThQ_x. Therefore, the present invention will use an adjustment factor (ad juss) to reduce the preset quantization matrix, and the initial value of the initial virtual buffer occupancy will be reduced to dO X / S. This adjustment factor; ς soap, ^ ^ ^ n翌: u sub 3 is a value less than 1, and it can be calculated from equation (5). The new quantization matrix w is calculated. Because of the quantization matrix, Lv] [] The minimum value is limited to j. 浐, is 1, so W, [v] [u] will not be described repeatedly. The operation of the performance is the same as that of the first embodiment. As long as it does not deviate from the present invention ... but does not limit the present invention to variations or changes. To say 'the lamp manufacturer can make various 1221742 _ case number 92112855_ year month month revision _ simple illustration Figure 1 is shown in the MPEG-2 specification The preset quantization matrix defined for the internal block. Figure 2 shows a schematic diagram of the VBV buffer in the CBR operation mode. Figure 3 shows a schematic diagram of the VBV buffer in the VBR operation mode. Figure 4 shows the quantization matrix adjustment for improving the image quality of the present invention. Flow chart of the first embodiment of the method. Figure 5 shows The flowchart of the second embodiment of the quantization matrix adjustment method for improving image quality of the present invention.
第20頁Page 20
Claims (1)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW92112855A TWI221742B (en) | 2003-05-12 | 2003-05-12 | Quantization matrix adjusting method for quality improvement |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
TW92112855A TWI221742B (en) | 2003-05-12 | 2003-05-12 | Quantization matrix adjusting method for quality improvement |
Publications (2)
Publication Number | Publication Date |
---|---|
TWI221742B true TWI221742B (en) | 2004-10-01 |
TW200425744A TW200425744A (en) | 2004-11-16 |
Family
ID=34389021
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
TW92112855A TWI221742B (en) | 2003-05-12 | 2003-05-12 | Quantization matrix adjusting method for quality improvement |
Country Status (1)
Country | Link |
---|---|
TW (1) | TWI221742B (en) |
-
2003
- 2003-05-12 TW TW92112855A patent/TWI221742B/en not_active IP Right Cessation
Also Published As
Publication number | Publication date |
---|---|
TW200425744A (en) | 2004-11-16 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7388995B2 (en) | Quantization matrix adjusting method for avoiding underflow of data | |
US6587508B1 (en) | Apparatus, method and computer program product for transcoding a coded moving picture sequence | |
JP5198869B2 (en) | Determination of quantization parameters for rate control of video encoders | |
TWI304297B (en) | Video encoding methods and systems with frame-layer rate control | |
US7092441B1 (en) | Moving pictures encoding with constant overall bit rate | |
KR101599561B1 (en) | Method and apparatus for rate control accuracy in video encoding and decoding | |
JP5770476B2 (en) | Method and apparatus for accurate rate control in video coding | |
TW200913722A (en) | Bitrate reduction techniques for image transcoding | |
JP2009528738A (en) | Method and apparatus for determining bit allocation for groups of pixel blocks in an image in image signal encoding | |
EP2027727A1 (en) | Method and apparatus for adaptively determining a bit budget for encoding video pictures | |
TW571589B (en) | Method of performing video encoding rate control using bit budget | |
JP2003018603A (en) | Method and device for encoding moving image | |
WO2004021704A1 (en) | Bit rate control for motion compensated video compression system | |
CN101325698A (en) | Bit rate control method and apparatus for intra-only video sequence coding | |
US20050232354A1 (en) | Rate controlling method and apparatus for use in a transcoder | |
KR20130135268A (en) | Video coding | |
CN100448295C (en) | Integration code rate control method of low complexity | |
TWI221742B (en) | Quantization matrix adjusting method for quality improvement | |
US7391916B2 (en) | Quantization matrix adjusting method for quality improvement | |
TWI301724B (en) | Bit rate automatic gear | |
JP3149673B2 (en) | Video encoding device, video encoding method, video reproducing device, and optical disc | |
WO2000046997A1 (en) | Video rate-buffer management scheme for mpeg transcoder | |
TWI221743B (en) | Quantization matrix adjusting method for avoiding underflow of data | |
JP2003018593A (en) | Method and apparatus for encoding video, method and apparatus for allocating video coding quantity, and recording medium | |
JP3393595B2 (en) | Moving picture coding apparatus and moving picture coding method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
MM4A | Annulment or lapse of patent due to non-payment of fees |