201036447 六、發明說明: 【發明所屬之技術領域】 本發明係關於一種視頻解碼方法,尤指一種在對^£(32格 式視頻執行反離散餘弦轉換(Inverse Diserete CQsine Transformation ’簡稱©CT)程序及運動補償(M〇ti〇n Compensation)程序時,能同時對數據塊進行降採樣處理,以大幅 減少資料處理量及降低運算複雜度,有效提高解碼速度,以解決 在低性能處理器上播放高解析度視頻時效率不彰的問題。 【先前技術】 視頻壓縮技.術從1990年起,如雨後春筍般地出現,當時,bo MPEG (Moving Picture Experts Groups)組織所提出的視頻壓縮標 準乃此一領域的主流,直到1994年,ISO MPEG組織制訂了 MPEG-2標準後,由於,mpEG_2標準採用了較新的壓縮技術, 不僅能支援交錯式掃描,並在系統的可靠度與影音質量上皆有顯 著的突破,因此,目前市面上流通的DVD視頻壓縮技術仍是以 MPEG-2技術為主流。 按’與MPEG-2 編碼器(encoder)相較,MPEG-2 解碼器(decoder) 的解壓縮運异(decompression algorithm)較不複雜,且僅需較少的 運异處理’此一基本特性,使得MPEG-2解碼器較容易被實現在 硬體裝置上。一般言,MPEG-2編碼器所產生的MPEG-2資料流 (stream)主要包括下列内容,參閱第丨圖所示: 201036447 (1) MPEG-2資料流10係由複數個圖羣(gf0UpS 〇f pictures) GOPO、GOP1、GOP2、…GOPn所組成。 (2) 每一個圖羣GOP包含複數個依序排列的圖像(a series 〇f pictures) I、B、P。 ⑶每一個圖像I、B、P係下列三種不同類型中之一種: (a) 内部編碼圖像(Intra-codedpicture,簡稱I-圖像):係依據原 始圖像本身提供的訊息(information),編碼而成,目的是使 〇 其能自圖羣序列(sequence)中被隨機存取(random access); (b) 預估編瑪圖像(Predictive-coded picture,簡稱P-圖像):係 使用運動補償估算法(motion compensated prediction;),依據 過去的參考圖像(past reference frame)或過去的參考圖場 (past reference field),編碼而成;及 (c)雙向預估編碼圖像(Bidirectionally predictive-coded picture ’簡稱B圖像):係使用運動補償估算法(moti〇n Ο compensated prediction),依據過去的參考圖像(past reference frame)及/或未來的參考圖場(future reference frame),編碼而成。 ⑷每一個圖像係被分割成複數個帶狀圖像(slices)。 (5) 每一帶狀圖像包含任一數目(大於零)的巨塊(macr〇blocks,簡 稱MB) 〇 (6) 每一巨瑰包含不同數目呈8x8矩陣排列的數據塊(blocks of data)ll ’ 在YUV(或稱YCbCr)的色彩模型(color model)中,該 5 201036447 等數據塊11依其性質的不同,被區分成下列三種: ⑻光度(Luminance,簡稱Y)數據塊:用以代表圖像中像素 (pixel)的灰階值(gray-scale)或灰階強度(gray_ intensity),包括 四個呈8x8矩陣排列的數據塊11 ; ⑼藍色度(Chrominanceblue,簡稱u ’或稱Cb)數據塊:用以 代表圖像中像素(pixel)的藍色值,包括一個呈8x8矩陣排 列的數據塊11 ; (b)紅色度(Chrominancered,簡稱V,或稱Cr)數據塊:用以 代表圖像中像素(pixel)的紅色值’包括一個呈8x8矩陣排列 的數據塊11。 ,其中各該色度(CrandCb)所包括的數據塊丨丨的數目,係隨 YUV編碼系統(c〇ding scheme)之不同,而改變。 查’ MPEG-2解碼器的解壓縮運算,參閱第2圖所示,主要包 括下列處理程序: ⑴可變長度解碼(Variable Length Decoding,簡稱VLD)程序 20 .係根據Huffinan形式的編碼(style coding),對MPEG-2資 料流中的編碼數據(coded data),分別進行解碼,以將各該編碼 數據中的碼值(values)轉換成一維陣列資料(〇ne_dimensi〇nal array)中的64個向量值(vector)。 (2)反掃描(InverseScan’簡稱IS)程序21 :係用以將該可變長度 解碼程序20處理後輸出的64個向量值轉換成呈8χ8矩陣排列 的二維矩陣資料(two-dimensionalmatrix),即呈8χ8矩陣排列的 201036447 數據塊,以供後續處理使用。 (3)反量化(Inverse Quantization,簡稱 IQ)程序 22 :量化 (Quantization)係用以減少(reduce)可能使用的碼值(possible values)的數量,反量化則是使碼值回復成接近於原始碼值 (original values),意即使各該數據塊的碼值回復成接近於離散 餘弦轉換(Discrete Cosine Transformation,以下簡稱DCT)系數 (coefficients)的原始碼值(original values)。 0 (4)反離散餘弦轉換(Inverse Discrete Cosine Transformation,以下 簡稱IDCT)程序23 :係用以將DCT系數轉換回代表圖像中呈 8x8矩陣排列的YUV格式像素(pixels)的數據塊,進而獲得内部 塊(Intra-block),並據以產生原始圖像的1_圖像,如此,即能輸 出原始圖像的I-圖像。 (5)運動補償(Motion Compensation,簡稱MC)程序24 :係以先 前儲存在一圖像儲存記憶體中的全部呈8x8矩陣排列的内部 〇 塊’作為參考數據塊(reference blocks),估算(estimate)出當前 呈8x8矩陣排列的内部塊中像素值的運動向量(m〇ti〇n vectors),並對其進行運動補償,以獲得當前内部塊的預測數 據塊(predictive block)及殘差數據塊(residualbl〇ck),進而計算 出呈8x8矩陣排列的中間塊(Inter-block),並據以計算出p_圖像 及B-圖像,如此’即能輸出原始圖像的?_圖像及B_圖像。 ⑹圖像儲存記憶(Frame-store Memory)程序25 :係用以儲存先前 獲得的全部呈8x8矩陣排列的内部塊,以作為估算出當前呈 201036447 矩陣排列的内部塊中像素值的運動向量的參考圖像。 性能不斷提昇,且價格較諸%主===== 為=日紅作及生活中不可或缺的視頻播放裝置,使得用戶得 ,===,各種視頻影片及節9,並予:: 記情體二心;^該等電子裝置的處理器的運算速度及 等一般個人電腦相比擬,故,用戶在該 會因處的運格式的各種視頻影片及節目時’經常 慢及記健_存容量从,而發生下 ⑴耗費較多的處理器時間:傳統雜EG2視頻解碼方法一般均 會對順G2格式資料流進行完整解碼,故,在性能較低的處 理器上播放MPEG2格式的視頻則及節目時,法做到即 _放的絲’尤狀’在處理雛能她的電子錢上播放 尚解析度視頻時,此一問題將更形嚴重。 ⑺耗費額外的降採樣_:如果該等電子裝置的顯示幕僅為輸 入視頻的1/4左右的尺寸比例時,傳統_eg2解碼方法通常 是先將視頻的原始尺寸,解碼成為醫格式的數據塊後再 進行降採樣處理,如此,不僅耗費了龐大的解碼時間,尚兩耗 費額外的降採樣時間’如此,將導致即時播放效率不^問 題’此一問題,在播放高解析度視頻時,將更為嚴重。 ⑺耗費較多的記憶體資源:由於,傳統的·Ε 係對ΜΡ臟格式資料流進行完整解碼,故’在』 201036447 產生及使用的大量數值,將佔用大量記憶體資源,致經常發生 記憶體空間不足的問題,尤其是,在記憶體容量較少的電子裝 置上播放高解析度視頻時,極易因記憶體空間不足,而盔法繼 續播放視頻。 因此,如何设計出一種MPEG2視頻解碼方法,使得該等電 子裝置在播放高解析度視頻時,不致因本身處理器的運算速度較 慢、疏體猶存容量較)及顯示幕的尺寸較小特性,而發生 前述問題,且能迅速完成解碼,即時地在顯示幕上呈現視頻影片 〇 及節目,以確保在該等電子裝置上播放高解析度視頻時的效能, 以符合大多數用戶的基本需求,即成為各撕啦視頻解碼器的 δ又5十及製造廠商虽欲達成的一重要目標。 【發明内容】 有赛於許乡電子裝置目本核理H運算速度較慢、記憶體健 存容量較少及顯示幕尺寸較小的特性,致在使用傳統撕啦視 ο 頻解碼方法’播放高解析度視頻時,無法迅速完成解碼,且無法 即時地在顯示幕上呈現視頻影片及節目的問題,發明人經長久努 力研究後’終於開發設計出本發明的一種對MPEG2格式視頻進 行降採樣解碼的方法。 本發月之目的,該方法係應用至一電子裝置,使該電子裂置 犯對所接1]欠或讀取的撕£〇2格式視頻進行射采樣解碼,該方法 子反里化程序所產生的呈8x8矩陣排列的數據塊中的Dct 系數’進行水平1/2降採樣的反離散餘弦轉換,得到呈4x8矩陣 201036447 排列的數據塊,以將數據塊中呈8χ8矩陣排列的DCT系數轉換回 代表圖像巾呈4x8矩__ WV格式像素值(pixds),獲得原 始數據塊1/2水平尺寸的内部鄉ntfa_bl〇ck) ’且在將呈知8矩陣 排列的内部塊輸出時,對其中的像素值進行垂直W的降採樣, 即能據以產生原細像1/2水平尺寸及1/2垂直尺寸的内部編喝 圖像(Intra-codedpicture,以下簡#1-圖像),意即能輸出原始圖像 1/4分辨率的i_圖像。 本發明之另-目的’在對降採樣叹丁程序所產生的原始數據 塊1/2水平尺寸的内部塊,進行運動麵程序時,以先前错存在 一圖像儲存記憶體中的全部呈4χ8矩陣排列的内部塊,作為參考 數據塊(referenceblocks) ’並根據當前呈4X8矩陣排列的内部塊的 像素值的向量’並對其進行運_償,以獲得祕數據塊 水平尺寸的預測數據塊(predictive block),且採用與内部塊相同的 方法得到殘差數據塊(residual block),將二者相加計算出呈4χ8矩 陣排列的中間塊(Inter-block),並在將呈4x8矩陣排列的中間塊輸 出時,對其進行垂直1/2的降採樣,並據以產生原始圖像1/2水 平尺寸及1/2垂直尺寸的預估編碼圖像picture, 以下簡稱p-圖像)及雙向預估編碼圖像(Bidirecti〇naUy pr—ed picture ’以下簡稱Β·圖像),意即能輸出原始圖 像1/4分辨率的Ρ-圖像及Β-圖像。如此,不僅成倍地減少了需處 理的圖像資料,大幅減少了一半的資料量及記憶體需求量,更大 幅降低了 MPEG-2視頻解碼運算的複雜度’有效提高了解碼的速 201036447 度’且解決了在低性能處理器上播放高解析度視頻時效率不彰的 問題。 兹為令責審查委員能對本發明之目的、處理程式及其功 效,能有更進—步之認識與瞭解’特列舉實施例,並配合圖^, 詳細說明如下: 【實施方式】 本發明係-種對mpEG2格式視舰妍採樣解碼的方法,該 方法係應用至-電子裝置,使得該電子裳置能對所接收或讀取的 MPEG2格式的視頻資料流進行降採樣—職㈣)解碼 (decoding) ’以在對視頻資料流(vide〇 str_s)進行解碼處理時,能 大幅減少㈣的處理量及記憶體的f求量,且大幅降低細EG] 視頻解碼運算的複雜度,有效提高解碼的速度,以有效解決在低 性能電子裝置的處理器上賊高騎度視頻時鱗不彰的問題, 該方法主要包括下列處理程序,參閱第3圖所示: (1) 一可變長度解碼(VariableLengthDecoding)程序30 :該可變長 度解碼程序30係相同於傳統MpEG2解碼器中所使用的可變 長度解碼程序,均係根據Huffinan編碼方式(c〇ding),對該視 頻資料流中代表一序列圖像(image 的編碼數據㈣ed data),力別進行解碼,以將各該編碼數據轉換成64個向量值 (vector);由於’該可變長度解碼程序3〇的本身已屬先前技藝, 且非本發明在此欲主張保護的技術重點,故在此不贅述其程序 11 201036447 的細節; (2) —反掃描(Inverse Scan)程序31 :該反掃描程序31係相同於 傳統MPEG2解碼器中所使用的反掃描程序,均係用以將各該 編碼數據對應的64個向量值轉換成8χ8矩陣排列的數據塊 (block);由於,該反掃描程序31的本身係屬於先前技藝,且 非本發明在此欲主張保護的技術重點,故在此不贅述其程序的 細節; ⑶一反量化(Inverse Quantization)程序32 :該反量化程序32係 ^ 相同於傳統MPEG2解碼器中所使用的反量化程序,均係用以 使各該數據塊的碼值(values)回復成接近於離散餘弦轉換 (Discrete Cosine Transformation,以下簡稱 DCT)系數 (coefficients)的原始碼值(original values);由於,該反量化程序 32的本身已屬於先前技藝,且非本發明在此欲主張保護的技 術重點,故在此不贅述其程序的細節; (4) 一降採樣(downscaling ’以下簡稱DS)的反離散餘弦轉換 u (Inverse Discrete Cosine Transformation,以下簡稱 IDCT)程序 33 :按,MPEG2格式的視頻資料流所包含的I-圖像,全部都 是由内部塊(Intra-block)所組成,對於YUV420的編碼系統 (coding scheme)而言,I-圖像的每個巨塊(macroblock)包含四個 呈8x8矩陣排列的光度數據塊,用以代表圖像中像素(pixel) 的灰階值(gray-scale)或灰階強度(gray- intensity),一個呈8x8 矩陣排列的藍色度數據塊,用以代表圖像中像素的藍色值,一 12 201036447 個呈8x8矩陣排列的紅色度數據塊,用以代表圖像中像素的 紅色值。該DS IDCT程序33係在對該反量化程序32所產生 的呈8x8矩陣排列的數據塊4〇中的DCT系數,進行傳統的 IDCT程序的同時’也進行水平1/2的降採樣,參閱第4圖所 示’以獲得呈4x8矩陣排列的數據塊,以在對數據塊中呈8x8 矩陣排列的DCT系數,進行DS IDCT程序33時,將DCT系 數轉換回代表圖像中呈4x8矩陣排列的YUV格式像素(pixels) 〇 的數據塊41,進而獲得原始數據塊1/2水平尺寸的内部塊 (Intra-block) ’且在將呈4x8矩陣排列的内部塊50輸出時,對 其中的像素值進行垂直1/2的降採樣,參閱第5圖所示’即能 得到原内部塊50 1/2水平尺寸及1/2垂直尺寸的内部塊51, 並據以產生原始圖像1/2水平尺寸及1/2垂直尺寸的内部編碼 圖像(Intra-coded picture ’以下簡稱I-圖像),意即能輸出原始 圖像1/4分辨率的I-圖像。 〇 (5) —降採樣的運動補償Compensation)程序34 :查, MPEG2格式的視頻資料流所包含的預估編碼圖像 (PredictWe-codedpicture’以下簡稱P-圖像)及雙向預估編碼圖 像(Bidirectionally predictive-cpded picture,以下簡稱 B-圖 像),可包含内部塊(Intra-block)和中間塊(Inter-block)兩種模 式’屬於内部塊的部份係採用與I-圖像相同的方式進行解碼, 如第4及5圖所示,屬於中間塊62的部份則是通過當前内部 塊的殘差數據塊(residual block)61及預測數據塊(predictive 13 201036447 block)60相加而獲得’參閱第6圖所示,在本發明中,對於該 殘差數據塊61中呈4x8矩陣排列的DCT系數’係進行傳統的 IDCT程序’以將DCT系數轉換回代表圖像中呈4x8矩陣排 列的YUV格式像素(pixels)的殘差數據塊61;對於該預測數據 塊60則是利用運動估計得到的運動向量,以先前儲存在一圖 像儲存記憶體中的全部呈4X8矩陣排列的内部塊’作為參考數 據塊,進行線性插值運算得到的結果,標準規定p_ 圖像只有前向一個參考圖像,1圖像可以有前向及後向兩個參 考圖像’故B-圖像的參考圖像只能是〗_圖像及/或卩_圖像,既 然’在該DSIDCT程序33中得到的I-圖像是原始圖像1/2的 降採樣結果’因此’在本發明中亦必須採用相應的降採樣的運 動補償程序34,參閱第7圖所示,意即當前數據塊70的尺寸 (解析度)必須是取決於參考數據塊71的尺寸,同時,在計算 運動補償時必須要針對從視頻資料流中得到的運動向量 (moti〇nvector ’以下簡稱mv)和數據塊(bl〇ck)的大小,進行如 下列公式的比例換算(scale): mv\x = (mvjc - sign(mvjc)) »1 την\γ = mv.y block9jc = blocks »1 = 8 »1 = 4 block\y = block.y = 8 ’用以計异水平1/2降採樣後的中間塊的尺寸大小和中間塊對 應的運動向量,其中mvx*mvy是原始中間塊的運動向量, mV’ ·χ和mv’ .y是降採樣後塊對應的運動向量,block.x和block.y 201036447 是中間塊的尺寸大小’block’·χ和block’.y是降採樣後塊對應的 尺寸大小,sign(x)是取X數據符號的運算符。因此,該降採樣 的運動補償程序34係以先前儲存在該圖像儲存記憶體中的全 部呈4x8矩陣排列的内部塊’作為參考數據塊(reference blocks) ’根據當前呈4x8矩陣排列的内部塊的像素值的運動向 量(motion vectors) ’並對其進行運動補償,以獲得原始數據塊 1/2水平尺寸的預測數據塊(predictive block)60,且與殘差數據 塊(residual block)61相加後,計算出呈4x8矩陣排列的中間塊 (Inter-bl〇ck)62 ’且在將該中間塊62輸出時,對該中間塊62進 行垂直1/2的降採樣,如此,即能據以產生原始圖像1/2水平 尺寸及1/2垂直尺寸的p_圖像及B_圖像,意即能輸出原始圖像 1/4分辨率的p_圖像及B_圖像。 ⑹一圖像儲存記憶(prame_st〇reMem〇ry)程序35:該圖像儲存記 憶程序35係利用該圖像儲存記憶體,儲存先前產生的全部呈 4x8矩陣排列的塊’以作為估算當前呈4x8矩陣排列的中間塊中 像素值的運動向量的參考數據塊。 由於本發明在執行IDCT程序及運動補償程序時,亦同時 據塊it行了降採樣冑理’目此,本發B賊傳統❸湖^2解 Μ相較具備如下所賴優異特點: (1) f於^本發明在解碼過程中,採用TDS mcT和DS運動補 對視頻資料流中的編碼數據進行降採樣處S,故成倍 / ^ 了要處理_像資料’大幅減少_半的資料量及記憶體 兩求置,故對於具有相同處理器能力的電子產品而言’本發明 15 201036447 的降採樣解碼方法能大幅降低MPEGj 度,大幅提高解碼速度及性能達4G%J^頻的複雜 解碼方式無法在低性能處理器上播放高解析度視躺問了題傳統 ⑺由於’本發明係在解碼過程中,同時進行降採樣處理,故在 完成對MPEG2格式資料流的解碼處理後,即無需再對蕾201036447 VI. Description of the Invention: [Technical Field] The present invention relates to a video decoding method, and more particularly to an Inverse Diserete CQsine Transformation (referred to as CT) program in a 32 format video and In the motion compensation (M〇ti〇n Compensation) program, the data block can be downsampled at the same time to greatly reduce the amount of data processing and reduce the computational complexity, and effectively improve the decoding speed to solve the high playback on the low performance processor. The problem of inefficiency in the resolution of video. [Prior Art] Video compression technology. Since 1990, it has sprung up. At that time, the video compression standard proposed by bo MPEG (Moving Picture Experts Groups) was one. The mainstream of the field, until 1994, after the ISO MPEG organization developed the MPEG-2 standard, because the mpEG_2 standard uses a newer compression technology, not only can support interlaced scanning, but also in the system reliability and audio and video quality. Significant breakthrough, therefore, the current DVD video compression technology currently on the market is still based on MPEG-2 technology. According to 'the MPEG-2 encoder, the decompression algorithm of the MPEG-2 decoder is less complex and requires less processing. This basic feature Therefore, the MPEG-2 decoder can be easily implemented on a hardware device. In general, the MPEG-2 stream generated by the MPEG-2 encoder mainly includes the following contents, as shown in the following figure: 201036447 ( 1) The MPEG-2 data stream 10 is composed of a plurality of pictures (gf0UpS 〇f pictures) GOPO, GOP1, GOP2, ... GOPn. (2) Each picture group GOP contains a plurality of sequentially arranged images (a Series 〇f pictures) I, B, P. (3) Each image I, B, P is one of the following three different types: (a) Intra-coded picture (I-picture): According to the information provided by the original image itself, the purpose is to enable it to be random access from the sequence of the group; (b) Predictive image (Predictive) -coded picture, referred to as P-image): using motion compensated prediction ), encoded according to a past reference frame or a past reference field; and (c) bidirectionally predictive-coded picture (abbreviated as B image) ): It is coded based on the past reference frame and/or the future reference frame using the motion compensation estimation method (moti〇n Ο compensated prediction). (4) Each image is divided into a plurality of strips. (5) Each strip image contains any number (greater than zero) of macroblocks (macr〇blocks, abbreviated as MB) 〇(6) Each jumbo contains a different number of blocks arranged in an 8x8 matrix (blocks of data) ) ll ' In the color model of YUV (or YCbCr), the data block 11 such as 5 201036447 is divided into the following three types according to their properties: (8) Luminance (Y) data block: used A gray-scale (gray-scale) or gray-scale intensity (gray_intensity) representing a pixel in an image, including four data blocks 11 arranged in an 8x8 matrix; (9) blueness (Chrominanceblue, u' or The data block is called Cb): it is used to represent the blue value of the pixel in the image, including a data block 11 arranged in an 8x8 matrix; (b) a Chrominancered (V, or Cr) data block: The red value ' used to represent the pixels in the image' includes a data block 11 arranged in an 8x8 matrix. The number of data blocks 包括 included in each of the chrominances (CrandCb) varies depending on the YUV coding system. Check the decompression operation of the MPEG-2 decoder, as shown in Figure 2, mainly including the following processing procedures: (1) Variable Length Decoding (VLD) program 20. It is based on the coding of the Huffinan form (style coding). The coded data in the MPEG-2 data stream is separately decoded to convert the code values in each of the encoded data into 64 of the one-dimensional array data (〇ne_dimensi〇nal array) Vector value (vector). (2) Inverse Scan (IS) program 21: The 64 vector values output by the variable length decoding program 20 are converted into two-dimensional matrix data arranged in a matrix of 8χ8, That is, the 201036447 data block arranged in a matrix of 8χ8 is used for subsequent processing. (3) Inverse Quantization (IQ) program 22: Quantization is used to reduce the number of possible values that can be used, and inverse quantization is to restore the code value to be close to the original. Original values, even if the code values of the data blocks are restored to be close to the original values of Discrete Cosine Transformation (hereinafter referred to as DCT) coefficients. 0 (4) Inverse Discrete Cosine Transformation (IDCT) program 23: is used to convert DCT coefficients back into data blocks representing YUV format pixels (pixels) arranged in an 8x8 matrix in the image. An intra-block, and accordingly, produces a 1_image of the original image, such that an I-picture of the original image can be output. (5) Motion Compensation (MC) program 24: Estimate (estimate) by using all internal blocks arranged in an 8x8 matrix previously stored in an image storage memory as reference blocks. The motion vectors (m〇ti〇n vectors) of the pixel values in the inner block currently arranged in the 8x8 matrix are motion compensated to obtain the predictive block and the residual data block of the current inner block. (residualbl〇ck), and then calculate the intermediate block (Inter-block) arranged in an 8x8 matrix, and calculate the p_image and the B-image accordingly, so that the original image can be outputted? _ image and B_ image. (6) Frame-store Memory program 25: is used to store all previously obtained internal blocks in an 8x8 matrix arrangement as a reference for estimating the motion vector of the pixel values in the internal block currently ranked in the 201036447 matrix. image. The performance is constantly improving, and the price is more than the % main ===== = red and the indispensable video player in the life, so that users get, ===, various video films and sections 9, and give:: The heart rate of the processor of these electronic devices is comparable to that of a general personal computer. Therefore, the user often 'slows and remembers the various video videos and programs in the format of the game. The storage capacity is from, and the next (1) consumes more processor time: the traditional hybrid EG2 video decoding method generally decodes the G2 format data stream completely, so the MPEG2 format video is played on the lower performance processor. Then, when the program is in progress, the law will be _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ (7) Expend additional downsampling_: If the display screen of these electronic devices is only about 1/4 of the input video, the traditional _eg2 decoding method usually decodes the original size of the video into medical format data. After the block, the downsampling process is performed. This not only consumes a large decoding time, but also consumes additional downsampling time. This will result in an instant playback efficiency that is not a problem. When playing high-resolution video, It will be more serious. (7) More memory resources: Since the traditional system completely decodes the dirty format data stream, the large number of values generated and used by 'in' 201036447 will occupy a large amount of memory resources, resulting in frequent memory. The problem of insufficient space, especially when playing high-resolution video on an electronic device with a small memory capacity, is extremely easy due to insufficient memory space, and the helmet method continues to play video. Therefore, how to design an MPEG2 video decoding method, so that the electronic device does not have a slower operation speed and a smaller memory capacity when the high-resolution video is played, and the display screen has a smaller size. Features, and the aforementioned problems occur, and decoding can be completed quickly, and video movies and programs are presented on the display screen in real time to ensure the performance of playing high-resolution video on the electronic devices to meet the basic needs of most users. Demand, that is, the δ and 50 of each tear-off video decoder and an important goal that manufacturers want to achieve. [Summary of the Invention] There is a feature in the Xuxiang electronic device that the H operation speed is slow, the memory storage capacity is small, and the display screen size is small, so that the traditional tear-down video decoding method is used to play In high-resolution video, the decoding cannot be completed quickly, and the problem of video film and program cannot be presented on the display screen in real time. After long-term research, the inventor finally developed and designed a downsampled video of MPEG2 format of the present invention. The method of decoding. For the purpose of this month, the method is applied to an electronic device, so that the electronic splitting person performs the sampling and decoding of the punctured or read-removed video of the received 1] format. The generated Dct coefficient in the data block of 8x8 matrix arrangement is subjected to horizontal 1/2 downsampling inverse discrete cosine transform to obtain data blocks arranged in 4x8 matrix 201036447, to convert DCT coefficients arranged in 8 χ 8 matrix in the data block. Representing the image towel as a 4x8 moment __ WV format pixel value (pixds), obtaining the inner data block 1/2 horizontal size of the original data block ntfa_bl〇ck) ' and when outputting the internal block of the 8 matrix array, The pixel value is subjected to down-sampling of the vertical W, that is, an internal image of the original fine image 1/2 horizontal size and 1/2 vertical size (Intra-coded picture, below #1-image) can be generated. This means that the i_image of the 1/4 resolution of the original image can be output. According to another aspect of the present invention, in the internal block of the 1/2 horizontal size of the original data block generated by the downsampling squeezing process, when the motion surface program is performed, all of the image storage memories are previously displayed as 4χ8. The inner block of the matrix arrangement is used as a reference block (and a vector of pixel values of the inner block currently arranged in a 4×8 matrix) and is compensated for to obtain a prediction block of the horizontal size of the secret block ( Predictive block), and the residual block is obtained in the same way as the inner block, and the two are added to calculate an intermediate block (Inter-block) arranged in a matrix of 4χ8, and arranged in a 4×8 matrix. When the intermediate block is output, it is vertically downsampled by 1/2, and accordingly, an estimated coded picture picture of the original image 1/2 horizontal size and 1/2 vertical size is generated, hereinafter referred to as p-image) and The bidirectional predictive coded image (Bidirecti〇naUy pr-ed picture 'hereinafter referred to as Β·image) means that the 1/4-image and the Β-image of the 1/4 resolution of the original image can be output. In this way, not only the image data to be processed is reduced by a factor of two, but also the amount of data and the memory demand are greatly reduced, and the complexity of the MPEG-2 video decoding operation is greatly reduced, effectively increasing the decoding speed of 201036447 degrees. 'And solve the problem of inefficiency when playing high-resolution video on low-performance processors. For the purpose of the invention, the purpose of the invention, the processing program and its effects, and the understanding and understanding of the present invention can be further described, and in conjunction with the drawings, the details are as follows: [Embodiment] The present invention is a method for sampling and decoding a mpEG2 format vista, which is applied to an electronic device such that the electronic squirrel can downsample (c) decode the received or read MPEG2 format video data stream ( Decoding) 'When the video data stream (vide〇str_s) is decoded, the amount of processing (4) and the amount of memory f can be greatly reduced, and the complexity of the video decoding operation of the fine EG] can be greatly reduced, and the decoding can be effectively improved. The speed to effectively solve the problem of the high-riding video on the low-performance electronic device processor, the method mainly includes the following processing procedures, as shown in Figure 3: (1) A variable length decoding (VariableLengthDecoding) program 30: The variable length decoding program 30 is the same as the variable length decoding program used in the conventional MpEG2 decoder, and is based on the Huffinan coding method (c〇ding). Decoding a sequence of images (image data of image) in the video data stream, and decoding each of the encoded data into 64 vector values; since the variable length decoding program 3 〇 本身 本身 已 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 本身 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 2010 31 is the same as the anti-scanning program used in the conventional MPEG2 decoder, and is used to convert 64 vector values corresponding to each of the encoded data into blocks of 8χ8 matrix arrangement; since, the inverse scanning program 31 It is a prior art, and the technical focus of the invention is not claimed here, so the details of the program are not described here. (3) Inverse Quantization program 32: The inverse quantization program 32 is the same as The inverse quantization procedure used in the conventional MPEG2 decoder is used to restore the code values of each data block to be close to the Discrete Cosine Transformation (DCT) system. The original values of the coefficients; since the inverse quantization program 32 itself belongs to the prior art, and the invention is not intended to claim the technical focus of the protection, the details of the program are not described herein; (4) Inverse Discrete Cosine Transformation (hereinafter referred to as IDCT) program 33 for downscaling (hereinafter referred to as DS): Press, I-pictures included in the video stream of MPEG2 format, all It is composed of an internal block (Intra-block). For the YUV420 coding scheme, each macroblock of the I-picture contains four photometric data blocks arranged in an 8x8 matrix. Gray-scale or gray-intensity representing a pixel in an image, a blue-degree data block arranged in an 8x8 matrix to represent the blue value of a pixel in an image , a 12 201036447 red degree data block arranged in an 8x8 matrix to represent the red value of the pixels in the image. The DS IDCT program 33 performs the conventional IDCT procedure while performing the conventional IDCT procedure on the DCT coefficients of the data block 4〇 arranged in the 8x8 matrix generated by the inverse quantization program 32. 4 shows 'to obtain a block of data arranged in a 4x8 matrix, to perform DC ID program 33 on the DCT coefficients arranged in an 8x8 matrix in the data block, and convert the DCT coefficients back to a 4x8 matrix arrangement in the representative image. YUV format pixels (pixels) 数据 data block 41, which in turn obtains the original block 1/2 horizontal size of the internal block (Intra-block) 'and when the internal block 50 arranged in a 4x8 matrix is output, the pixel value is Perform vertical 1/2 downsampling, as shown in Figure 5, to obtain the inner block 51 of the original inner block 50 1/2 horizontal size and 1/2 vertical size, and generate the original image 1/2 level accordingly. Intra-coded picture (hereinafter referred to as I-picture) of size and 1/2 vertical size means that I-picture of 1/4 resolution of the original image can be output. 〇(5)—Sampling Motion Compensation Compensation Program 34: Check, Predict We-coded Picture (P-picture) and Bidirectional Predicted Code Image included in the MPEG2 format video data stream (Bidirectionally predictive-cpded picture, hereinafter referred to as B-picture), which can include two modes: Intra-block and Inter-block. The part belonging to the internal block is the same as the I-picture. In the manner of decoding, as shown in FIGS. 4 and 5, the portion belonging to the intermediate block 62 is added by the residual block 61 of the current internal block and the predictive data block (predictive 13 201036447 block) 60. And obtaining 'see Fig. 6, in the present invention, the conventional IDCT program is performed for the DCT coefficients of the 4x8 matrix arrangement in the residual data block 61 to convert the DCT coefficients back to the representative image as 4x8. a residual data block 61 of YUV format pixels arranged in a matrix; for the prediction data block 60, a motion vector obtained by motion estimation is arranged in a 4×8 matrix array previously stored in an image storage memory. internal 'As a reference data block, the result of linear interpolation operation, the standard stipulates that the p_ image has only one forward reference image, and the one image can have two reference images in the forward and backward directions. The image can only be a _image and/or 卩_image, since the 'I-image obtained in the DSIDCT program 33 is the downsampled result of the original image 1/2', therefore also in the present invention A corresponding downsampled motion compensation procedure 34 must be employed, as shown in Figure 7, which means that the size (resolution) of the current data block 70 must be dependent on the size of the reference data block 71, and must be calculated when calculating motion compensation. To scale the motion vectors (moti〇nvector 'mv) and data block (bl〇ck) obtained from the video stream, perform a scaling as follows: mv\x = (mvjc - sign (mvjc)) »1 την\γ = mv.y block9jc = blocks »1 = 8 »1 = 4 block\y = block.y = 8 ' to measure the size of the intermediate block after 1/2 downsampling The motion vector corresponding to the size and the middle block, where mvx*mvy is the motion vector of the original intermediate block, mV' And mv'.y is the motion vector corresponding to the block after the downsampling, block.x and block.y 201036447 is the size of the middle block 'block'·χ and block'.y is the size corresponding to the block after downsampling, sign (x) is an operator that takes an X data symbol. Therefore, the downsampled motion compensation program 34 uses the internal blocks 'received blocks' in the 4x8 matrix arrangement previously stored in the image storage memory as 'internal blocks arranged according to the current 4x8 matrix. The motion vectors of the pixel values are 'motion compensated' to obtain a predictive block 60 of the original data block 1/2 horizontal size, and is associated with the residual block 61 After the addition, an intermediate block (Inter-bl〇ck) 62' arranged in a 4x8 matrix is calculated, and when the intermediate block 62 is output, the intermediate block 62 is vertically downsampled by 1/2, so that The p_image and the B_image which produce the original image 1/2 horizontal size and 1/2 vertical size mean that the p_image and the B_image of the original image 1/4 resolution can be output. (6) an image storage memory (prame_st〇reMem〇ry) program 35: the image storage memory program 35 uses the image storage memory to store all previously generated blocks arranged in a 4x8 matrix 'as an estimate of the current 4x8 A reference data block of a motion vector of pixel values in an intermediate block of a matrix arrangement. Since the present invention performs the IDCT program and the motion compensation program, it also performs the downsampling process according to the block. The original B-thief traditional Wuhu ^2 solution has the following characteristics: (1) In the decoding process, the TDS mcT and the DS motion complement are used to downsample the coded data in the video data stream, so that it is multiplied / ^ to process the image data 'substantially reduced _ half of the data The quantity and the memory are both set, so for the electronic products with the same processor capability, the downsampling decoding method of the invention 15 201036447 can greatly reduce the MPEGj degree, and greatly improve the decoding speed and the performance up to 4G% J frequency. The decoding method cannot play high-resolution on the low-performance processor. (7) Since the present invention performs the downsampling process in the decoding process, after the decoding process of the MPEG2 format data stream is completed, No need to bud
格式的數魏進_外崎採樣纽’故,當電计置的顯示 幕僅為輸人視_ 1/4左右的尺寸_時,將能立即播放完成 解碼的視頻影纽節目,有效解決傳統解财式料在低性能 處理器上實現播放高解析度視頻的問題。 (3)在時域上,本發明的降採樣解碼器的輸出圖像均來自於同一 個採樣圖像資料(逐行圖像或隔行場),因此,在電子裝置的顯 示幕上顯示圖像資料之前,無需對圖像資料進行去交織 (de-interlacing)處理,且可直接用於顯示在lcd顯示幕上,有 利於降低電子裝置的顯示幕的整個顯示系統的複雜度,有效提 高顯示幕的系統性能。 以上所述,僅為本發明之一最佳具體實施例,惟本發明I) 之設計並不侷限於此,任何熟悉該項技藝者在本發明領域 内,可輕易思及之變化或修飾,皆可涵蓋在以下本案之申請 專利範圍内。 【圖式簡單說明】 第1圖所示係傳統MPEG-2編碼方法所產生的MPEG-2資料流的 架構示意圖; 16 201036447 第2圖所示_統_邮2解碼方法的流程示意圖; 塊的流程示意圖 第3圖解係本發料峨似降採樣解碼枝的_示意圖; 第4圖所稀本翻餅雜狀離錄_触种將DCT 系數轉換回代表圖像中呈秘矩陣排列的撕格式像素的數據 第5圖所示縣购在__絲錄_馳种對呈4x8 矩陣排_魏㈣騎健行Μ 1/2的__的示意The format of the number Wei Jin _ Waisaki sampling New Zealand, so when the display screen of the electricity meter is only the size of the input _ 1/4 or so, will be able to immediately play the decoded video and video program, effectively solve the traditional solution The financial system is designed to play high-resolution video on low-performance processors. (3) In the time domain, the output images of the downsampling decoder of the present invention are all from the same sample image data (progressive image or interlaced field), and therefore, the image is displayed on the display screen of the electronic device. Before the data, there is no need to de-interlacing the image data, and it can be directly used for display on the LCD display screen, which is beneficial to reducing the complexity of the entire display system of the display screen of the electronic device, and effectively improving the display screen. System performance. The above description is only one of the best embodiments of the present invention, but the design of the present invention I) is not limited thereto, and any one skilled in the art can easily change or modify it in the field of the invention. All of them can be covered in the following patent application scope of this case. [Simplified description of the drawing] Fig. 1 is a schematic diagram showing the architecture of the MPEG-2 data stream generated by the conventional MPEG-2 encoding method; 16 201036447 Fig. 2 is a flow chart showing the decoding method of the _ unified_mail 2 decoding method; The third diagram of the flow diagram is a schematic diagram of the present invention, which is similar to the downsampling decoding branch. The thin image of the thinning cake in Fig. 4 converts the DCT coefficients back to the tearing format of the representative matrix in the image. Pixel data shown in Figure 5 is shown in the __丝录_驰种对4x8 matrix row_魏(四)骑健行Μ 1/2 of the __
«· 第6騎示縣發明在降採樣的運動補償程序中計算出中間塊的 流程不意圖;及 第7圖所示係本發_降採樣的運動補償程序的示意圖。 【主要元件符號說明】 可變長度解碼程序 〇 反掃描程序 反量化程序 30 31 32 33 34 35 40 41 50 降採樣的反離散餘弦轉換程序 降採樣的運動補償程序 圖像儲存記憶程序 呈8x8矩陣排列的DCT系數的數據塊 呈4x8矩陣排列的YUV格式像素的數據塊 呈4x8矩陣排列的内部塊 17 201036447 垂直1/2降採樣的内部塊 51 預測數據塊 60 殘差數據塊 61 中間塊 62 當前數據塊 70 參考數據塊 71 18«· The 6th ride shows that the process of calculating the intermediate block in the motion compensation program for downsampling is not intended; and Fig. 7 is a schematic diagram of the motion compensation program for the present _ downsampling. [Major component symbol description] Variable length decoding program 〇 inverse scanning program inverse quantization program 30 31 32 33 34 35 40 41 50 Downsampled inverse discrete cosine conversion program Downsampling motion compensation program Image storage memory program is arranged in 8x8 matrix The data blocks of the DCT coefficients are in a 4x8 matrix arrangement. The data blocks of the YUV format pixels are arranged in a 4x8 matrix. The internal block 17 201036447 The vertical 1/2 downsampled internal block 51 The prediction data block 60 The residual data block 61 The intermediate block 62 Current data Block 70 reference data block 71 18