• 沒有找到結果。

第三章 新的演算法

3.3 演算法流程

最後我們來整理一下整個流程:

方法一

1) 先在 Search Window 中央做一個小型的 Diamond Search,記錄下五個點中的 最大以及最小點,若最小點在 Diamond 形狀 Pattern 的中央,則搜尋終止,使

用 Zero Motion Vector;反之,則令中央周圍四點之最大 Distortion 為 DB,Pattern 中央點之 Distortion 為 DA,設 EDR = DB / DA,檢查 EDR 是否超過門檻值(這 裡設為 0.9)。若 EDR 小於等於門檻值,進入步驟 2)。

2) 利用之前記錄下的最大及最小點,以最大點往最小點的方向為 DAS 的方向,

並在該方向上加入對應的 Pattern,計算新加入的三個點,並與上一步的最小 點 Distortion 做比較,若上一步之最小 Distortion 之點仍為最小點,則終止搜

28

尋,進入步驟 5);若 Minimum Distortion 發生在新加入的 Pattern 上,則重複 之前加入 Pattern 並比較的動作,直到最小 Distortion 之位置不再變化,進入 步驟 5)。

3) 若 EDR 大於門檻值,則展開圖 3.1 的 Pattern,計算這八個點,並與上一步 DS 中之 Distortion 最小點作比較,若上一步之最小點仍為 Minimum Distortion,

則以該點做為起始位置;若 Minimum Distortion 發生在圖 3.1 之 Pattern 的八 個點上,則以該點作為中心點,做一個小型的 Diamond Search。

4) 在 Diamond 形狀的 Pattern 中,若中心點為 Minimum Distortion,則跳到步驟 5)。若 Minimum Distortion 發生在中心點周圍四個點上,則執行步驟 2)。

5) 以之前找到的 Minimum Distortion 之點為中心,搜尋周圍鄰近的八個點,跟 中心點做比較,以最後的 Minimum Distortion 之點為 Motion Vector。

29

方法二

1) 先計算小型 Diamond Search Pattern 的五個點。

2) 以中心點之 Distortion 為 DA,周圍四點最小之 Distortion 設為 DB,以(DB / DA) 跟門檻值做比較,決定展開演算法之位置。若周圍四點之 Distortion 皆大於中 心點,則最後傳出 Zero Motion Vector。

3) 若(DB / DA)小於等於門檻值則從起始 Pattern 最小點位置展開演算法。

4) 若(DB / DA)大於門檻值,則跳出一定距離,在 DAS 方向以及鄰近兩個方向(見 圖 3.3)上作測試,若 DAS 方向上該點小於上一步之最小點,則在該點位置作

DAS 該方向性的 Pattern(見圖 3.4);若 DAS 方向上該點大於上一步之最小點,

則依逆時鐘順序測試圖 3.3 上鄰近方向之點,剩下步驟與上面相同。若三點 皆大於起始 Pattern 之最小值,則以起始 Pattern 為新演算法展開位置。

30

第四章實驗結果以及數據探討

4.1 實驗結果

要評估我們演算法的效能的話,就要在 H.264 的實做軟體 JM 14.2 上面實 作。我們將使用 Intel Core 2 6320 1.86GHz 的 CPU 還有 1GB 的 RAM,以及在

MS 的 Window XP 下,使用 Visual Studio 2005 來做為我們的實驗環境。我們將 會以 tempete、mobile、stefan、foreman、akiyo、news 及 football 等數個 CIF(352

x 288,4:2:0)測試影片來做測試。這邊的 GOP(Group Of Pictures)設為 IPPP,壓 縮量化參數 QP(Quantisation Parameter)設為 28。

作為評估效能的項目有 PSNR(Peak Signal to Noise Ratio)、Bitrates 以及 Total

Encoding Time;實驗的對照組則以 DAS、SPS 以及 UMHexagonS 做為主要的比 較對象,因為 UMHexagonS 是 JM 裡面的一種預設的 BMA,而且它的搜尋速度 以及效果都相當優秀,所以也選用它來做為我們的對照演算法。

31

方法一

表 4.1 Full Search 與 UMHexagonS 的比較

Full Search UMHeaxagonS

PSNR Bitrates Time PSNR Bitrates Time

32

方法二

表 4.3 新演算法實驗結果

新演算法

psnr bitrates time

akiyo 40.43 223.82 41.873

news 38.92 425.59 45.194

foreman 37.59 530.78 49.208

football 35.63 1566.96 44.862

tempete 35.86 1379.39 55.796

mobile 35.32 2130.01 62.354

stefan 36.64 1397.72 25.041

coastguard 35.86 1149.98 56.075

33

coastguard 35.86 1149.97 60.819

表 4.5 與 DAS 比較之加速百分比

akiyo news foreman football tempete mobile stefan coastguard

T 8.73% 9.31% 8.91% 8.65% 7.69% 6.86% 7.54% 7.80%

34

表 4.6 SPS 實驗數據

SPS

psnr bitrates time

akiyo 40.44 224.82 45.138

news 38.92 431.52 49.192

foreman 37.63 571.49 58.288

football 35.64 1602.33 51.479

tempete 35.86 1397.11 61.526

mobile 35.32 2165.35 68.636

stefan 36.68 1454.64 28.158

coastguard 35.88 1171.68 64.386

35

coastguard 35.86 1145.35 86.442

表 4.8 與 UMHexagonS 比較之加速百分比

akiyo news foreman football tempete mobile stefan coastguard

T 14.31% 20.07% 30.62% 32.19% 28.34% 26.99% 25.11% 35.13%

36

4.2 數據探討

方法一

實驗的結果在表 4.1~4.2,可以看到我們的演算法在 PSNR 上面可以跟

UMHexagonS 達到一樣的水準,而 Bitrates 在稍差(不到 1%)的狀況下,快了 17%~20%的 Total Encoding Time。

我們使用 UMHexagonS 做為對照組,由表 4.1 可得知,UMHexagonS 效能 非常逼近 Full Search,PSNR 部分與 Full Search 近乎一樣,Bitrates 部分也是微微 的落後,相差非常小的距離;但 UMHexagonS 可以提升相當多的效率,所以

UMHexagonS 可以算是一種相當優秀的演算法,因此使用它做為對照組。

方法二

實驗的結果在表 4.3~表 4.6,我們的新演算法可以在 PSNR 幾乎一樣,而

Bitrates 損失不到 1%的狀況下,在整體編碼時間上,對於 DAS 有 8%左右的提升。

37

第五章 結論

實驗的結果顯示我們的方法有很好的成效,分述如下:

方法一

我們提出一種新的 Block Motion Algorithm,它利用 DAS (Directional

Asymmetric Search)可以快速完成搜尋的特性,結合了 SPS (Search Pattern Switching)可以估測 Motion Vector 遠近的功能,來克服 DAS 容易碰到 Local Minimum 的狀況,可以找到更好或是最好的 Motion Vector。新的演算法可以在 跟 UMHexagonS 比較時,有相同的 PSNR 以及差距不到 1%的 Bitrates 狀況下,

快了 17%~20%的 Encoding Time。

方法二

提供了一種更快速的 BMA,利用 SPS 估測 MV 的優點,可以避免做太長 的 DAS 或陷入 Local Minimum 的狀況,保留大部分 DAS 的特性,在更節省計算 點數的狀況下,我們可以獲得比 DAS 快 8%及比 UMHexagonS 快 26%左右速度 的提升,與 DAS 比較 Bitrates 會升高非常微小的幅度;與 UMHexagonS 約略會 升高 1% Bitrates。

38

Motion Estimation 的搜尋演算法已經被許多人研究過了,算是一個很成熟 的研究題目,未來我們想再進一步提升的話,除了更新穎的創意之外,再來就要 好好觀察跟 Motion Vector 有關的資訊,才能更有效的估計到 Motion Vector 的位 置,進一步的去想出更有效的演算法,去提升搜尋的速度。

39

參考文獻

[1] “Advanced Video Coding for Generic Audiovisual Services (ITU-T Rec.H.264 | ISO/IEC 144496-10 AVC),” Joint Video Team of ISO/IEC and ITU-T, 2005.

[2] Iain E. G.Richardson , “H.264 and MPEG-4 Video Compression,”wiley , Baker &

Taylor Books, 2003.

[3]Shan Zhu and Kai-Kuang Ma, “A new diamond search algorithm for fast block-matching motion estimation,” Image Processing, IEEE Transactions, Volume: 9, Issue: 6, Feb, 2000 Page(s):287-290.

[4]T. Koga, K. Iinuma, A. Hirano, Y. Iijima, and T. Ishiguro, “Motion compensated interframe coding for video conferencing, ” in Proc. Nat. Telecommun, Conf., NO, L.A., Nov-Dec 1981, pp. G5.3.1-G.5.3.5.

[5] L. K. Liu and E. Feig, “A block-based gradient descent search algorithm for block motion estimation in video coding, ” IEEE Trans. on Circuits and Systems for Video Technology, vol. 6, pp. 419-422, Aug 1996.

[6] C.M. Kuo, Y.H. Kuan, C.H. Hsieh and Y.H. Lee , “A Novel Prediction-Based Directional Asymmetric Search Algorithm for Fast Block-Matching Motion Estimation,” IEEE Transactions on Circuits and Systems for Video Technology, Vol. 19, No. 6, 2009, pp893-899.

[7] K.H. Ng, L.M. Po, K.M. Wong, C.W. Ting and K.W. Cheung, “A Search Patterns Switching Algorithm for Block Motion Estimation,” IEEE Transactions on Circuits and Systems for Video Technology, Vol. 19, No. 5, 2009, pp753-759.

[8]C.H. Cheung and L.M. Po, “Novel Cross-Diamond-Hexagonal Search Algorithms for Fast Block Motion Estimation,” Multimedia, IEEE Transactions on, Volume 7, Issue 1, Feb. 2005 Page(s):16 – 22

[9] H. Zeng, C. Cai, and K.K. Ma, “Fast Mode Decision for H.264/AVC Based on Macroblock Motion Activity,” IEEE Transactions on Circuits and Systems for Video Technology, Vol. 19, No. 4, 2009, pp.1-10.

相關文件