TWI709326B - Lossless image compression method - Google Patents

Lossless image compression method Download PDF

Info

Publication number
TWI709326B
TWI709326B TW108120791A TW108120791A TWI709326B TW I709326 B TWI709326 B TW I709326B TW 108120791 A TW108120791 A TW 108120791A TW 108120791 A TW108120791 A TW 108120791A TW I709326 B TWI709326 B TW I709326B
Authority
TW
Taiwan
Prior art keywords
pixel
pixels
leaf
residual value
group
Prior art date
Application number
TW108120791A
Other languages
Chinese (zh)
Other versions
TW202046727A (en
Inventor
李宇軒
桂承鴻
高悅展
范姜士松
Original Assignee
元智大學
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 元智大學 filed Critical 元智大學
Priority to TW108120791A priority Critical patent/TWI709326B/en
Application granted granted Critical
Publication of TWI709326B publication Critical patent/TWI709326B/en
Publication of TW202046727A publication Critical patent/TW202046727A/en

Links

Images

Landscapes

  • Compression Of Band Width Or Redundancy In Fax (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

本發明係一種無損影像壓縮方法,包含擷取16x8影像區塊並分割成根像素、多個幹像素、多個分枝像素、多個左葉像素、多個右葉像素、計算幹像素的殘值、計算分枝像素的殘值、計算左葉像素的殘值、計算右葉像素的殘值、分割16x8影像區塊成原始像素、第一像素群組、第二像素群組、第三像素群組、第四像素群組、第五像素群組、第六像素群組以及第七像素群組、設定每個像素群組的編碼表頭、串接根像素、多個編碼表頭及多個殘值以產生壓縮資料串。因此,本發明無損影像壓縮方法可達成6.4G(pixel/sec)高吞吐量,能滿足4K影像的即時壓縮需求。The present invention is a lossless image compression method, including capturing a 16x8 image block and dividing it into root pixels, multiple dry pixels, multiple branch pixels, multiple left-leaf pixels, multiple right-leaf pixels, and calculating residuals of dry pixels. Value, calculate the residual value of the branched pixel, calculate the residual value of the left leaf pixel, calculate the residual value of the right leaf pixel, divide the 16x8 image block into the original pixel, the first pixel group, the second pixel group, and the third pixel Group, fourth pixel group, fifth pixel group, sixth pixel group, and seventh pixel group, setting the encoding header of each pixel group, concatenating root pixels, multiple encoding headers, and more A residual value to generate a compressed data string. Therefore, the lossless image compression method of the present invention can achieve a high throughput of 6.4G (pixel/sec) and can meet the real-time compression requirements of 4K images.

Description

無損影像壓縮方法Lossless image compression method

本發明係有關於一種無損影像壓縮方法,尤其是關於影像無損壓縮以及硬體設計,利用達4K解析度吞吐量且具低複雜度的演算法以滿足4K解析度的吞吐量需求。 The present invention relates to a lossless image compression method, in particular to lossless image compression and hardware design, which utilizes 4K resolution throughput and low complexity algorithms to meet 4K resolution throughput requirements.

隨著科技的進步,高清(HD)圖像/視頻已成為一項重要功能現代顯示技術,近來,HD已從1,920×1,080(1080p)提升到3,840×2,160(2160p或4K)。這種趨勢推動了視頻壓縮標準能夠處理高清視頻內容,使得H.264/AVC被採用為1080p的藍光光盤的視頻壓縮標準。 With the advancement of technology, high-definition (HD) images/videos have become an important function of modern display technology. Recently, HD has been upgraded from 1,920×1,080 (1080p) to 3,840×2,160 (2160p or 4K). This trend has pushed the video compression standard to handle high-definition video content, making H.264/AVC adopted as the video compression standard for 1080p Blu-ray Discs.

然而,這種發展趨勢給視頻編碼系統帶來了兩個設計挑戰:大吞吐量和巨大的內存帶寬。雖然通過先進的CMOS工藝和適當的平行處理或pipeline技術可以解決吞吐量巨大的問題,但是上述方法卻無法解決巨大的內存帶寬。理由是,這種設計上的挑戰在於一些內存密集型的視頻編碼過程,例如運動估計,幀內預測和濾波。目前,這個瓶頸可以通過嵌入式壓縮來解決,而其嵌入式壓縮可以分為兩種類型:有損嵌入式壓縮和無損嵌入式壓縮,其中有損嵌入式壓縮產生之誤差會降低視覺效果質量,而無損嵌入式壓縮不僅可以提供可接受的壓縮率,且還能保持視覺質量。 However, this development trend brings two design challenges to video coding systems: large throughput and huge memory bandwidth. Although advanced CMOS technology and appropriate parallel processing or pipeline technology can solve the huge throughput problem, the above-mentioned methods cannot solve the huge memory bandwidth. The reason is that the challenge of this design lies in some memory-intensive video coding processes, such as motion estimation, intra prediction and filtering. At present, this bottleneck can be solved by embedded compression, and its embedded compression can be divided into two types: lossy embedded compression and lossless embedded compression. The error generated by lossy embedded compression will reduce the quality of visual effects. The lossless embedded compression can not only provide acceptable compression rates, but also maintain visual quality.

進一步而言,可藉由嵌入式壓縮以減少視頻編碼系統和幀存儲器之間的存儲器帶寬,然而其演算法的吞吐量必須達到能夠支援顯示裝置所能提供的解析度大小。 Furthermore, embedded compression can be used to reduce the memory bandwidth between the video encoding system and the frame memory. However, the throughput of the algorithm must be able to support the resolution provided by the display device.

更加具體而言,在影像壓縮中,預測編碼是常用的技術,而且歷史已相當之久,最早可以追溯到40年代提出的Delta編碼(Delta modulation),乃至於到今日我們都還可以常常看到線性預測編碼的技術不斷的改進、革新、強化。簡而言之,預測編碼是屬於時間領域的編碼法。他的基本理念是利用前面已經出現了的符號來預測目前的符號,然後將實際上的符號與預測符號得到預測誤差,將此誤差編碼並送出。 More specifically, predictive coding is a commonly used technology in image compression, and it has a long history. It can be traced back to the Delta coding (Delta modulation) proposed in the 1940s, and we can still see it often today. The technology of linear predictive coding is continuously improved, innovated and strengthened. In short, predictive coding is a coding method that belongs to the time domain. His basic idea is to use the symbols that have appeared before to predict the current symbol, and then obtain the prediction error from the actual symbol and the predicted symbol, encode and send the error.

上述預測誤差的編碼法可以採用無失真資料壓縮法或失真資料壓縮法。若採用前者,則整個系統仍然是無失真資料壓所法;反之,若採用後者,則整個系統就成了失真資料壓縮法。因此,預測編碼既是屬於無失真資料壓縮法,也是屬於失真資料壓縮法。使用預測編碼的動機是誤差訊號的變化要比原訊號的變化小許多,因此我們可以使用比較少的位元來為每一個誤差訊號的取樣做編碼以達到資料壓縮的目的。 The above-mentioned coding method for the prediction error can be a lossless data compression method or a distortion data compression method. If the former is adopted, the entire system is still a distortion-free data compression method; on the contrary, if the latter is adopted, the entire system becomes a distortion-free data compression method. Therefore, predictive coding is not only a lossless data compression method, but also a distortion data compression method. The motivation for using predictive coding is that the change of the error signal is much smaller than that of the original signal, so we can use fewer bits to encode each error signal sample to achieve the purpose of data compression.

隨著4K解析度的影像漸漸成為主流規格,為滿足吞吐量的需求,習用技術的演算法會導致硬體面積過大,且功率消耗過多,進而造成系統過熱,有當機失效的風險。 As 4K resolution images gradually become the mainstream specifications, in order to meet throughput requirements, the algorithms of conventional technologies will cause excessive hardware area and excessive power consumption, which in turn will cause the system to overheat and risk crashes.

再者,現有之影像無損壓縮技術大多無法滿足4K影像的即時壓縮需求,而雖然有少部分演算法技術可滿足即時壓縮,但是壓縮率不足,對內存傳輸頻寬有較大的負擔,常發生資料漏失的問題。 Moreover, most of the existing image lossless compression technologies cannot meet the real-time compression requirements of 4K images. Although there are a small number of algorithm technologies that can meet the real-time compression, the compression rate is insufficient, which places a greater burden on the memory transmission bandwidth, which often occurs The problem of missing data.

因此,非常需要一種創新的無損影像壓縮方法,利用複雜度低的演算法,達到高畫質、高吞吐量、無損壓縮、低硬體面積、低功率消耗的具體功效,藉以解決上述習用技術的所有問題。 Therefore, there is a great need for an innovative lossless image compression method that uses a low-complexity algorithm to achieve the specific effects of high image quality, high throughput, lossless compression, low hardware area, and low power consumption, so as to solve the above-mentioned conventional technology. All questions.

本發明之主要目的在於提供一種無損影像壓縮方法,利用預測處理及編碼處理以實現無損影像壓縮的功能。具體而言,本發明的無損影像壓縮方法包括擷取輸入影像資料中的16x8影像區塊,當作處理區塊,且處理區塊包含矩陣排列的16x8像素,並接著將處理區塊的所有像素分割成根像素、多個幹像素、多個分枝像素、多個左葉像素及多個右葉像素。 The main purpose of the present invention is to provide a lossless image compression method that utilizes prediction processing and encoding processing to realize the function of lossless image compression. Specifically, the lossless image compression method of the present invention includes capturing a 16x8 image block in the input image data as a processing block, and the processing block includes 16x8 pixels arranged in a matrix, and then all pixels of the processing block Divide into root pixels, multiple stem pixels, multiple branch pixels, multiple left leaf pixels, and multiple right leaf pixels.

進一步而言,根像素為該16x8像素中的像素(1,1),是位於處理區塊的左上角,該等幹像素是像素(1,2)至(1,16),該等分枝像素是像素(6,2)至(8,12)的對角線上之像素,該等左葉像素是位於該等分枝像素之左側及該根像素、該等幹像素之間的像素,該等右葉像素是位於該等分枝像素之右側及該等幹像素之間的像素。 Furthermore, the root pixel is the pixel (1, 1) in the 16x8 pixel, which is located in the upper left corner of the processing block, and the dry pixels are pixels (1, 2) to (1, 16). The branches Pixels are pixels on the diagonal of pixels (6, 2) to (8, 12). The left-leaf pixels are pixels located to the left of the branch pixels and between the root pixel and the stem pixels. The equal right leaf pixels are pixels located to the right of the branch pixels and between the stem pixels.

然後,對處理區塊中的每個幹像素進行殘值計算以獲得每個幹像素的殘值,且每個幹像素的殘值是表示成:幹像素-幹像素的左側像素,且幹像素的左側像素是位於幹像素的左側。 Then, the residual value of each dry pixel in the processing block is calculated to obtain the residual value of each dry pixel, and the residual value of each dry pixel is expressed as: dry pixel-left pixel of the dry pixel, and dry pixel The left pixel of is located to the left of the dry pixel.

類似的,對處理區塊中的每個分枝像素進行殘值計算以獲得每個分枝像素的殘值,且每個分枝像素的殘值是表示成:分枝像素-分枝像素的上方像素,且分枝像素的上方像素是位於分枝像素的上方。 Similarly, the residual value of each branch pixel in the processing block is calculated to obtain the residual value of each branch pixel, and the residual value of each branch pixel is expressed as: branch pixel-branch pixel The upper pixel, and the upper pixel of the branch pixel is located above the branch pixel.

之後,對處理區塊中的每個左葉像素進行殘值計算以獲得每個左葉像素的殘值,且每個左葉像素的殘值是表示成:左葉像素-min(HL1,HL2,HL3),而min(HL1,HL2,HL3)為HL1、HL2、HL3中的最小值,其中HL1為(左葉像素的右上方像素+左葉像素的上方像素)/2,HL2為(左葉像素的右側像素+左葉像素的上方像素)/2,HL3為(左葉像素的右上方像素+左葉像素的右側像素)/2,且左葉像素的右上方像素是位於左葉像素的右上方,左葉像素的上方像素是位於左葉像素的上方,左葉像素的右側像素是位於左葉像素的右側。 After that, the residual value of each left-leaf pixel in the processing block is calculated to obtain the residual value of each left-leaf pixel, and the residual value of each left-leaf pixel is expressed as: left-leaf pixel-min(HL1, HL2 , HL3), and min (HL1, HL2, HL3) is the minimum of HL1, HL2, HL3, where HL1 is (the upper right pixel of the left leaf pixel + the upper pixel of the left leaf pixel)/2, and HL2 is (left The right pixel of the leaf pixel + the upper pixel of the left leaf pixel)/2, HL3 is (the upper right pixel of the left leaf pixel + the right pixel of the left leaf pixel)/2, and the upper right pixel of the left leaf pixel is located in the left leaf pixel The upper right pixel of the left leaf pixel is located above the left leaf pixel, and the right pixel of the left leaf pixel is located on the right side of the left leaf pixel.

對處理區塊中的每個右葉像素進行殘值計算,以獲得每個右葉像素的殘值,且每個右葉像素的殘值是表示成:右葉像素-min(HR1、HR2、HR3),而min(HR1、HR2、HR3)為HR1、HR2、HR3中的最小值,其中HR1為(右葉像素的左上方像素+右葉像素的上方像素)/2,HR2為(右葉像素的左側像素+右葉像素的上方像素)/2,HR3為(右葉像素的左上方像素+右葉像素的左側像素)/2,且右葉像素的左上方像素是位於右葉像素的左上方,右葉像素的上方像素是位於右葉像素的上方,右葉像素的左側像素是位於右葉像素的左側。 The residual value of each right-leaf pixel in the processing block is calculated to obtain the residual value of each right-leaf pixel, and the residual value of each right-leaf pixel is expressed as: right-leaf pixel-min(HR1, HR2, HR3), and min (HR1, HR2, HR3) is the minimum of HR1, HR2, HR3, where HR1 is (the upper left pixel of the right leaf pixel + the upper pixel of the right leaf pixel)/2, and HR2 is (right leaf The left pixel of the pixel + the upper pixel of the right leaf pixel)/2, HR3 is (the upper left pixel of the right leaf pixel + the left pixel of the right leaf pixel)/2, and the upper left pixel of the right leaf pixel is located in the right leaf pixel On the upper left, the upper pixel of the right leaf pixel is located above the right leaf pixel, and the left pixel of the right leaf pixel is located on the left side of the right leaf pixel.

將16x8影像區塊的像素分割成原始像素、第一像素群組、第二像素群組、第三像素群組、第四像素群組、第五像素群組、第六像素群組以及第七像素群組,其中原始像素為根像素,第一像素群組包含所有的幹像素,第二像素群組包含除像素(8,12)以外的所有的分枝像素,第三像素群組包含所有左葉像素中像素(2,1)至像素(8,4)的區塊內之所有像素,第四像素群組包含所有左葉像素中除去第三像素群組以及像素(8,5)至像素(8,11)的橫向排列之所有像素以外的其餘像素,第五像素群組包含所有右葉像素中除去位於像素(5,10)至像素(5,16)下方之所有像素的其餘像素,第六像素群組包含所有右葉像素除去第五像素 群組以及像素(8,13)至像素(8,16)的橫向排列像素以外的其餘像素,第七像素群組包含像素(8,1)至像素(8,16)的所有橫向排列的像素。 Divide the pixels of the 16x8 image block into original pixels, first pixel group, second pixel group, third pixel group, fourth pixel group, fifth pixel group, sixth pixel group, and seventh pixel group Pixel group, where the original pixel is the root pixel, the first pixel group contains all the dry pixels, the second pixel group contains all the branch pixels except the pixel (8, 12), and the third pixel group contains all All pixels in the block from pixel (2,1) to pixel (8,4) in the left-leaf pixel, the fourth pixel group includes all the left-leaf pixels except the third pixel group and pixels (8,5) to Pixels (8, 11) are arranged horizontally except for all the remaining pixels. The fifth pixel group includes all the right-leaf pixels except for the remaining pixels below the pixel (5, 10) to the pixel (5, 16) , The sixth pixel group contains all right-leaf pixels except the fifth pixel The group and the pixels (8, 13) to the pixel (8, 16) are arranged laterally except for the remaining pixels. The seventh pixel group includes all the pixels (8, 1) to (8, 16) arranged laterally. .

針對每個像素群組,依據每個像素所對應的殘值的絕對值的範圍,設定編碼表頭(header),並以三位元表示該編碼表頭。 For each pixel group, a coding header is set according to the absolute value range of the residual value corresponding to each pixel, and the coding header is represented by three bits.

最後,依據預設的排列次序,將根像素、編碼表頭及殘值藉串接而產生16x8影像區塊所對應的壓縮資料串,或稱作位元串。 Finally, according to the preset arrangement sequence, the root pixel, the code header and the residual value are concatenated to generate the compressed data string corresponding to the 16x8 image block, or called the bit string.

更加具體而言,上述的排列次序是指由先而後包含根像素、第一像素群組的編碼表頭至第七像素群組的編碼表頭、第一像素群組中每個像素的殘值至第七像素群組中每個像素的殘值。 More specifically, the aforementioned arrangement order refers to the first pixel group including the root pixel, the encoding header of the first pixel group to the encoding header of the seventh pixel group, and the residual value of each pixel in the first pixel group. To the residual value of each pixel in the seventh pixel group.

本發明的無損影像壓縮方法可降低內存頻寬,且達成6.4G(pixel/sec)高吞吐量,能滿足4K影像的即時壓縮需求,非常適合應用於需要快速、即時影像壓縮的領域。 The lossless image compression method of the present invention can reduce the memory bandwidth, and achieve a high throughput of 6.4G (pixel/sec), can meet the real-time compression requirements of 4K images, and is very suitable for applications that require fast and real-time image compression.

S10、S20、S30、S40:步驟 S10, S20, S30, S40: steps

S50、S60、S70、S80:步驟 S50, S60, S70, S80: steps

R:原始像素 R: raw pixels

G1:第一像素群組 G1: The first pixel group

G2:第二像素群組 G2: The second pixel group

G3:第三像素群組 G3: The third pixel group

G4:第四像素群組 G4: The fourth pixel group

G5:第五像素群組 G5: The fifth pixel group

G6:第六像素群組 G6: The sixth pixel group

G7:第七像素群組 G7: seventh pixel group

PC:目標像素 PC: target pixel

PT:上方像素 PT: upper pixel

PL:左側像素 PL: left pixel

PR:右側像素 PR: Right pixel

PLT:左上方像素 PLT: upper left pixel

PRT:右上方像素 PRT: upper right pixel

RT:根像素 RT: Root pixel

T:幹像素 T: dry pixel

B:分枝像素 B: branch pixel

LL:左葉像素 LL: left leaf pixel

RL:右葉像素 RL: Right leaf pixel

第一圖顯示依據本發明實施例無損影像壓縮方法的操作流程圖。 The first figure shows the operation flowchart of the lossless image compression method according to the embodiment of the present invention.

第二圖顯示依據本發明實施例無損影像壓縮方法中16x8影像區塊的示意圖。 The second figure shows a schematic diagram of a 16x8 image block in a lossless image compression method according to an embodiment of the invention.

第三圖顯示依據本發明實施例本發明實施例無損影像壓縮方法中目標像素之相鄰像素的示意圖。 The third figure shows a schematic diagram of adjacent pixels of the target pixel in the lossless image compression method according to the embodiment of the present invention.

第四圖顯示依據本發明實施例無損影像壓縮方法中分割16x8影像區塊成第一至第七像素群組的示意圖。 The fourth figure shows a schematic diagram of dividing a 16x8 image block into first to seventh pixel groups in a lossless image compression method according to an embodiment of the present invention.

以下配合圖示及元件符號對本發明之實施方式做更詳細的說明,俾使熟習該項技藝者在研讀本說明書後能據以實施。 The following is a more detailed description of the implementation of the present invention in conjunction with the drawings and component symbols, so that those who are familiar with the art can implement it after studying this manual.

請參考第一圖,本發明實施例無損影像壓縮方法的操作流程圖。如第一圖所示,本發明的無損影像壓縮方法包括步驟S10、S20、S30、S40、S50、S60、S70、S80,用以對輸入的影像資料進行預測處理及編碼處理而實現無損影像壓縮的功能,可大幅降低所需的內存頻寬,並保持高品質的影像。 Please refer to the first figure, which is an operation flowchart of a lossless image compression method according to an embodiment of the present invention. As shown in the first figure, the lossless image compression method of the present invention includes steps S10, S20, S30, S40, S50, S60, S70, S80, which are used to perform prediction processing and encoding processing on the input image data to achieve lossless image compression The function can greatly reduce the required memory bandwidth and maintain high-quality images.

首先,本發明的無損影像壓縮方法是從的步驟S10開始,主要是擷取輸入影像資料中的16x8影像區塊,當作處理區塊,亦即處理區塊包含矩陣排列的16x8像素,並將這些像素分割成不同群組。如第二圖所示,像素(1,1)是位於處理區塊的左上角,稱為根像素RT,像素(1,2)至(1,16)是從相鄰於根像素的像素開始往右到右側邊緣的像素,稱為幹像素T,在像素(6,2)至(8,12)的對角線上之像素是分枝像素B,位於分枝像素左側及根像素、幹像素之間的像素為左葉像素LL,位於分枝像素右側及幹像素之間的像素為右葉像素RL。 First of all, the lossless image compression method of the present invention starts from step S10, which mainly captures 16x8 image blocks in the input image data as processing blocks, that is, the processing blocks include 16x8 pixels arranged in a matrix, and These pixels are divided into different groups. As shown in the second figure, the pixel (1, 1) is located in the upper left corner of the processing block, called the root pixel RT, and the pixels (1, 2) to (1, 16) start from the pixels adjacent to the root pixel The pixel on the right to the right edge is called the dry pixel T. The pixel on the diagonal of pixels (6, 2) to (8, 12) is the branch pixel B, which is located on the left side of the branch pixel and the root pixel and the dry pixel The pixel in between is the left leaf pixel LL, and the pixel located to the right of the branch pixel and between the stem pixels is the right leaf pixel RL.

為方便以下說明,如第三圖所示,在將某一像素當作目標像素PC時,則位於目標像素PC的上方、左側、右側、左上方、右上方的像素是分別當作上方像素PT、左側像素PL、右側像素PR、左上方像素PLT、右上方像素PRT。 For the convenience of the following description, as shown in the third figure, when a certain pixel is regarded as the target pixel PC, the pixels located above, left, right, upper left, and upper right of the target pixel PC are respectively regarded as the upper pixel PT , Left pixel PL, right pixel PR, upper left pixel PLT, upper right pixel PRT.

接著,進入步驟S20,對處理區塊中的每個幹像素T進行殘值計算,以獲得幹像素T的殘值r,且表示成:幹像素T-幹像素T的左側像素PL,其中幹像素T的左側像素PL是位於幹像素T的左側,亦即,第三圖中的目標像素PC此時是指幹像素T。 Then, go to step S20, perform residual value calculation on each dry pixel T in the processing block to obtain the residual value r of the dry pixel T, and it is expressed as: dry pixel T-left pixel PL of dry pixel T, where dry The left pixel PL of the pixel T is located on the left side of the dry pixel T, that is, the target pixel PC in the third figure refers to the dry pixel T at this time.

在步驟S30中,對處理區塊中的每個分枝像素B進行殘值計算,以獲得分枝像素B的殘值r,且表示成:分枝像素B-分枝像素B的上方像素PT,其中 分枝像素B的上方像素PT是位於分枝像素B的上方,亦即,第三圖中的目標像素PC此時是指分枝像素B。 In step S30, the residual value calculation is performed on each branch pixel B in the processing block to obtain the residual value r of the branch pixel B, which is expressed as: branch pixel B-the upper pixel PT of branch pixel B ,among them The upper pixel PT of the branch pixel B is located above the branch pixel B, that is, the target pixel PC in the third figure refers to the branch pixel B at this time.

在步驟S40中,對處理區塊中的每個左葉像素LL進行殘值計算,以獲得左葉像素LL的殘值r,且表示成:左葉像素LL-min(HL1,HL2,HL3),而min(HL1,HL2,HL3)為HL1、HL2、HL3中的最小值,其中HL1為(左葉像素LL的右上方像素PRT+左葉像素LL的上方像素PT)/2,HL2為(左葉像素LL的右側像素PR+左葉像素LL的上方像素PT)/2,HL3為(左葉像素LL的右上方像素PRT+左葉像素LL的右側像素PR)/2,亦即,第三圖中的目標像素PC此時是指左葉像素LL,且左葉像素LL的右上方像素PRT是位於左葉像素LL的右上方,左葉像素LL的上方像素PT是位於左葉像素LL的上方,左葉像素LL的右側像素PR是位於左葉像素LL的右側。 In step S40, the residual value of each left-leaf pixel LL in the processing block is calculated to obtain the residual value r of the left-leaf pixel LL, which is expressed as: left-leaf pixel LL-min (HL1, HL2, HL3) , And min (HL1, HL2, HL3) is the minimum of HL1, HL2, and HL3, where HL1 is (the upper right pixel PRT of the left leaf pixel LL + the upper pixel PT of the left leaf pixel LL)/2, and HL2 is (left The right pixel PR of the leaf pixel LL + the upper pixel PT of the left leaf pixel LL)/2, HL3 is (the upper right pixel PRT of the left leaf pixel LL + the right pixel PR of the left leaf pixel LL)/2, that is, in the third figure The target pixel PC at this time refers to the left-leaf pixel LL, and the upper-right pixel PRT of the left-leaf pixel LL is located at the upper right of the left-leaf pixel LL, and the upper pixel PT of the left-leaf pixel LL is located above the left-leaf pixel LL, The right pixel PR of the left leaf pixel LL is located to the right of the left leaf pixel LL.

在步驟S50中,對處理區塊中的每個右葉像素RL進行殘值計算,以獲得右葉像素RL的殘值r,且表示成:右葉像素RL-min(HR1、HR2、HR3),而min(HR1、HR2、HR3)為HR1、HR2、HR3中的最小值,其中HR1為(右葉像素RL的左上方像素PLT+右葉像素RL的上方像素PT)/2,HR2為(右葉像素RL的左側像素PL+右葉像素RL的上方像素PT)/2,HR3為(右葉像素RL的左上方像素PLT+右葉像素RL的左側像素PL)/2,亦即,第三圖中的目標像素PC此時是指右葉像素RL,且右葉像素RL的左上方像素PLT是位於右葉像素RL的左上方,右葉像素RL的上方像素PT是位於右葉像素RL的上方,右葉像素RL的左側像素PL是位於右葉像素RL的左側。 In step S50, the residual value of each right-leaf pixel RL in the processing block is calculated to obtain the residual value r of the right-leaf pixel RL, which is expressed as: right-leaf pixel RL-min (HR1, HR2, HR3) , And min (HR1, HR2, HR3) is the minimum of HR1, HR2, HR3, where HR1 is (the upper left pixel PLT of the right leaf pixel RL + the upper pixel PT of the right leaf pixel RL)/2, and HR2 is (right The left pixel PL of the leaf pixel RL+the upper pixel PT of the right leaf pixel RL)/2, HR3 is (the upper left pixel PLT of the right leaf pixel RL+the left pixel PL of the right leaf pixel RL)/2, that is, in the third figure The target pixel PC at this time refers to the right-leaf pixel RL, and the upper-left pixel PLT of the right-leaf pixel RL is located at the upper left of the right-leaf pixel RL, and the upper pixel PT of the right-leaf pixel RL is located above the right-leaf pixel RL, The left pixel PL of the right leaf pixel RL is located on the left side of the right leaf pixel RL.

具體而言,上述的步驟S20、S30、S40、S50屬於預測處理,可獲得每個像素的殘值r。 Specifically, the aforementioned steps S20, S30, S40, and S50 belong to the prediction process, and the residual value r of each pixel can be obtained.

之後,進行編碼處理的過程,包含步驟S60、S70、S80。 After that, the process of encoding processing includes steps S60, S70, and S80.

首先進入步驟S60,依據第四圖,將16x8影像區塊分割成原始像素R、第一像素群組G1、第二像素群組G2、第三像素群組G3、第四像素群組G4、第五像素群組G5、第六像素群組G6以及第七像素群組G7。具體而言,原始像素R為上述的根像素,第一像素群組G1包含所有的幹像素,第二像素群組G2包含除像素(8,12)以外的所有的分枝像素,第三像素群組G3包含所有左葉像素中像素(2,1)至像素(8,4)的區塊內像素,合計6x4,共24像素,第四像素群組G4包含所有左葉像素中除去第三像素群組G3以及像素(8,5)至像素(8,11)的橫向排列像素以外的其餘像素,第五像素群組G5包含所有右葉像素中除去位於像素(5,10)至像素(5,16)下方之像素的其餘像素,第六像素群組G6包含所有右葉像素除去第五像素群組G5以及像素(8,13)至像素(8,16)的橫向排列像素以外的其餘像素,第七像素群組G7包含像素(8,1)至像素(8,16)的所有橫向排列的像素。 First, go to step S60. According to the fourth figure, divide the 16x8 image block into the original pixel R, the first pixel group G1, the second pixel group G2, the third pixel group G3, the fourth pixel group G4, and the fourth pixel group G2. The five pixel group G5, the sixth pixel group G6, and the seventh pixel group G7. Specifically, the original pixel R is the above-mentioned root pixel, the first pixel group G1 includes all dry pixels, the second pixel group G2 includes all branch pixels except the pixel (8, 12), and the third pixel Group G3 includes all the pixels in the block from pixel (2,1) to pixel (8,4) in all the left-leaf pixels, totaling 6x4, a total of 24 pixels, the fourth pixel group G4 includes all the left-leaf pixels except the third Pixel group G3 and pixels (8, 5) to pixels (8, 11) are arranged horizontally except for the remaining pixels. The fifth pixel group G5 includes all the pixels located in the right leaf except for pixels (5, 10) to pixels ( 5, 16) The remaining pixels of the pixels below, the sixth pixel group G6 includes all right-leaf pixels except for the fifth pixel group G5 and the pixels (8, 13) to (8, 16) horizontally arranged. Pixels, the seventh pixel group G7 includes all the pixels arranged horizontally from the pixel (8, 1) to the pixel (8, 16).

在步驟S70中,針對每個像素群組,依據每個像素所對應的殘值的絕對值的範圍,設定編碼表頭(header),並以三位元表示。具體而言,在所有像素的殘值皆為0時,編碼表頭為000;在殘值的絕對值之範圍為0~1時,編碼表頭為001;在殘值的絕對值之範圍為0~3時,編碼表頭為010;在殘值的絕對值之範圍為0~7時,編碼表頭為011;在殘值的絕對值之範圍為0~15時,編碼表頭為100;在殘值的絕對值之範圍為0~31時,編碼表頭為101;在殘值的絕對值之範圍為0~63時,編碼表頭為110;在殘值的絕對值之範圍超出0~63時,編碼表頭為111。 In step S70, for each pixel group, according to the absolute value range of the residual value corresponding to each pixel, a coding header is set and represented by three bits. Specifically, when the residual value of all pixels is 0, the coding header is 000; when the absolute value of the residual value is in the range of 0 to 1, the coding header is 001; when the absolute value of the residual value is in the range 0~3, the coding header is 010; when the absolute value of the residual value is in the range of 0-7, the coding header is 011; when the absolute value of the residual value is in the range of 0-15, the coding header is 100 ; When the absolute value of the residual value ranges from 0 to 31, the coding header is 101; when the absolute value of the residual value ranges from 0 to 63, the coding header is 110; when the absolute value of the residual value exceeds the range 0~63, the code header is 111.

在步驟S80中,依據預設的排列次序,將根像素、多個編碼表頭及多個殘值串接而產生16x8影像區塊所對應的壓縮資料串,或稱作位元串(bitstearm),其中預設的排列次序是指由先而後包含根像素、第一像素群組的編 碼表頭至第七像素群組的編碼表頭、第一像素群組中每個像素的殘值至第七像素群組中每個像素的殘值。 In step S80, the root pixel, multiple encoding headers, and multiple residual values are concatenated according to a preset arrangement order to generate a compressed data string corresponding to a 16x8 image block, or called a bit string (bitstearm) , The preset arrangement order refers to the arrangement of the root pixel and the first pixel group from first to last The code table header to the code table header of the seventh pixel group, the residual value of each pixel in the first pixel group to the residual value of each pixel in the seventh pixel group.

在上述的壓縮資料串中,因每個像素群組的編碼表頭具3位元,因此,第一至第七像素群組的編碼表頭合計為21位元(7x3),而編碼表頭的數值大小是表示像素群組中每個像素的殘值所使用的位元數。簡言之,當編碼表頭的數值較小時,表示像素群組中每個像素的殘值所佔據的位元數也較小。 In the above-mentioned compressed data string, since the encoding header of each pixel group has 3 bits, the total encoding headers of the first to seventh pixel groups are 21 bits (7x3), and the encoding header The value of is the number of bits used to represent the residual value of each pixel in the pixel group. In short, when the value of the encoding header is small, it means that the number of bits occupied by the residual value of each pixel in the pixel group is also small.

綜上所述,本發明的特點在於利用影像區快分割、預測處理、編碼處理以具體實現無損(lossless)內埋式壓縮(embedded compression,(EC)的影像壓縮演算法,壓縮率(Compression Ratio,CR)可高達2.24,不僅可節省內存頻寬約55.4%,並能同時保持高品質的影像。舉例而言,如果以CMOS 0.18um的半導體技術將本發明的方法製作成晶片而運作,則最大吞吐量可達6.4G(pixel/sec),且3,840x2,160@60fps,足可滿足4K影像的即時壓縮需求。 In summary, the feature of the present invention lies in the use of image area fast segmentation, prediction processing, and encoding processing to specifically realize lossless (lossless) embedded compression (EC) image compression algorithm, compression ratio (Compression Ratio) , CR) can be as high as 2.24, which not only saves about 55.4% of the memory bandwidth, but also maintains high-quality images. For example, if the method of the present invention is made into a chip with CMOS 0.18um semiconductor technology, then The maximum throughput can reach 6.4G (pixel/sec) and 3,840x2,160@60fps, which can meet the real-time compression requirements of 4K images.

以上所述者僅為用以解釋本發明之較佳實施例,並非企圖據以對本發明做任何形式上之限制,是以,凡有在相同之發明精神下所作有關本發明之任何修飾或變更,皆仍應包括在本發明意圖保護之範疇。 The above descriptions are only used to explain the preferred embodiments of the present invention, and are not intended to limit the present invention in any form. Therefore, any modifications or changes related to the present invention made under the same spirit of the invention , Should still be included in the scope of the invention's intention to protect.

S10、S20、S30、S40:步驟 S10, S20, S30, S40: steps

S50、S60、S70、S80:步驟 S50, S60, S70, S80: steps

Claims (2)

一種無損影像壓縮方法,包括:擷取一輸入影像資料中的16x8影像區塊,當作一處理區塊,該處理區塊包含矩陣排列的16x8像素,並將該處理區塊的所有像素分割成一根像素、多個幹像素、多個分枝像素、多個左葉像素及多個右葉像素,該根像素為該16x8像素中的像素(1,1),是位於該處理區塊的左上角,該等幹像素是像素(1,2)至(1,16),該等分枝像素是像素(6,2)至(8,12)的一對角線上之像素,該等左葉像素是位於該等分枝像素之左側及該根像素、該等幹像素之間的像素,該等右葉像素是位於該等分枝像素之右側及該等幹像素之間的像素;對該處理區塊中的每個該幹像素進行殘值計算以獲得每個該幹像素的殘值,且每個該幹像素的殘值是表示成:該幹像素-該幹像素的左側像素,且該幹像素的左側像素是位於該幹像素的左側;對該處理區塊中的每個該分枝像素進行殘值計算以獲得每個該分枝像素的殘值,且每個該分枝像素的殘值是表示成:該分枝像素-該分枝像素的上方像素,且該分枝像素的上方像素是位於該分枝像素的上方;對該處理區塊中的每個該左葉像素進行殘值計算以獲得每個該左葉像素的殘值,且每個該左葉像素的殘值是表示成:該左葉像素-min(HL1,HL2,HL3),而min(HL1,HL2,HL3)為HL1、HL2、HL3中的最小值,其中HL1為(該左葉像素的右上方像素+該左葉像素的上方像素)/2,HL2為(該左葉像素的右側像素+該左葉像素的上方像素)/2,HL3為(該左葉像素的右上方像素+該左葉像素的右側像素)/2,且該左葉像素的右上方像素是位於該左葉像素的右上方,該左葉像素的上方像素是位於該左葉像素的上方,該左葉像素的右側像素是位於該左葉像素的右側; 對該處理區塊中的每個該右葉像素進行殘值計算,以獲得每個該右葉像素的殘值,且每個該右葉像素的殘值是表示成:該右葉像素-min(HR1、HR2、HR3),而min(HR1、HR2、HR3)為HR1、HR2、HR3中的最小值,其中HR1為(該右葉像素的左上方像素+該右葉像素的上方像素)/2,HR2為(該右葉像素的左側像素+該右葉像素的上方像素)/2,HR3為(該右葉像素的左上方像素+該右葉像素的左側像素)/2,且該右葉像素的左上方像素是位於該右葉像素的左上方,該右葉像素的上方像素是位於該右葉像素的上方,該右葉像素的左側像素是位於該右葉像素的左側;將該16x8影像區塊的該等像素分割成一原始像素、一第一像素群組、一第二像素群組、一第三像素群組、一第四像素群組、一第五像素群組、一第六像素群組以及一第七像素群組,該原始像素為該根像素,該第一像素群組包含所有的該等幹像素,該第二像素群組包含除像素(8,12)以外的所有的該等分枝像素,該第三像素群組包含所有該等左葉像素中像素(2,1)至像素(8,4)的區塊內之所有像素,該第四像素群組包含所有該等左葉像素中除去該第三像素群組以及像素(8,5)至像素(8,11)的橫向排列之所有像素以外的其餘像素,該第五像素群組包含所有該等右葉像素中除去位於像素(5,10)至像素(5,16)下方之所有像素的其餘像素,該第六像素群組包含所有該等右葉像素除去該第五像素群組以及像素(8,13)至像素(8,16)的橫向排列像素以外的其餘像素,該第七像素群組包含像素(8,1)至像素(8,16)的所有橫向排列的像素;針對每個該像素群組,依據每個該像素所對應的殘值的一絕對值的範圍,設定一編碼表頭(header),並以三位元表示該編碼表頭;以及依據預設的一排列次序,將該根像素、該等編碼表頭及該等殘值藉串接而產生該16x8影像區塊所對應的一壓縮資料串,或稱作一位元串(bitstearm), 其中該排列次序是指由先而後包含該根像素、該第一像素群組的編碼表頭至該第七像素群組的編碼表頭、該第一像素群組中每個像素的殘值至該第七像素群組中每個像素的殘值。 A lossless image compression method, including: capturing a 16x8 image block in input image data as a processing block, the processing block includes 16x8 pixels arranged in a matrix, and dividing all the pixels of the processing block into one Root pixel, multiple dry pixels, multiple branch pixels, multiple left-leaf pixels, and multiple right-leaf pixels. The root pixel is the pixel (1, 1) in the 16x8 pixel and is located at the upper left of the processing block Angle, the dry pixels are pixels (1, 2) to (1, 16), the branch pixels are pixels on the diagonal of pixels (6, 2) to (8, 12), the left leaves Pixels are pixels located to the left of the branch pixels and between the root pixel and the stem pixels, and the right leaf pixels are pixels located to the right of the branch pixels and between the stem pixels; The residual value of each dry pixel in the processing block is calculated to obtain the residual value of each dry pixel, and the residual value of each dry pixel is expressed as: the dry pixel-the left pixel of the dry pixel, and The left pixel of the dry pixel is located on the left side of the dry pixel; the residual value of each branch pixel in the processing block is calculated to obtain the residual value of each branch pixel, and each branch pixel The residual value of is expressed as: the branch pixel-the upper pixel of the branch pixel, and the upper pixel of the branch pixel is located above the branch pixel; each of the left leaf pixels in the processing block The residual value calculation is performed to obtain the residual value of each left-leaf pixel, and the residual value of each left-leaf pixel is expressed as: the left-leaf pixel-min(HL1, HL2, HL3), and min(HL1, HL2 , HL3) is the minimum of HL1, HL2, and HL3, where HL1 is (the upper right pixel of the left leaf pixel + the upper pixel of the left leaf pixel)/2, and HL2 is (the right pixel of the left leaf pixel + the The upper pixel of the left leaf pixel)/2, HL3 is (the upper right pixel of the left leaf pixel + the right pixel of the left leaf pixel)/2, and the upper right pixel of the left leaf pixel is located at the upper right of the left leaf pixel In other words, the upper pixel of the left leaf pixel is located above the left leaf pixel, and the right pixel of the left leaf pixel is located on the right side of the left leaf pixel; The residual value of each right-leaf pixel in the processing block is calculated to obtain the residual value of each right-leaf pixel, and the residual value of each right-leaf pixel is expressed as: the right-leaf pixel-min (HR1, HR2, HR3), and min (HR1, HR2, HR3) is the minimum of HR1, HR2, HR3, where HR1 is (the upper left pixel of the right leaf pixel + the upper pixel of the right leaf pixel)/ 2. HR2 is (the left pixel of the right leaf pixel + the upper pixel of the right leaf pixel)/2, HR3 is (the upper left pixel of the right leaf pixel + the left pixel of the right leaf pixel)/2, and the right leaf pixel The upper left pixel of the leaf pixel is located at the upper left of the right leaf pixel, the upper pixel of the right leaf pixel is located above the right leaf pixel, and the left pixel of the right leaf pixel is located on the left side of the right leaf pixel; The pixels of the 16x8 image block are divided into an original pixel, a first pixel group, a second pixel group, a third pixel group, a fourth pixel group, a fifth pixel group, and a second pixel group. Six pixel groups and a seventh pixel group, the original pixel is the root pixel, the first pixel group includes all the dry pixels, and the second pixel group includes pixels (8, 12) All the branch pixels, the third pixel group includes all the pixels in the block from pixel (2, 1) to pixel (8, 4) in all the left-leaf pixels, and the fourth pixel group includes Among all the left-leaf pixels, except for the third pixel group and all pixels in the horizontal arrangement of pixels (8, 5) to (8, 11), the fifth pixel group includes all the right pixels. The remaining pixels of the leaf pixels except all the pixels below the pixel (5, 10) to the pixel (5, 16), the sixth pixel group includes all the right leaf pixels, the fifth pixel group and the pixel (8 , 13) to the pixels (8, 16) in the horizontal arrangement of pixels other than the remaining pixels, the seventh pixel group includes all the pixels (8, 1) to the pixel (8, 16) in the horizontal arrangement; for each In the pixel group, an encoding header is set according to an absolute value range of the residual value corresponding to each pixel, and the encoding header is represented by three bits; and according to a preset arrangement order, The root pixel, the encoding headers, and the residual values are concatenated to generate a compressed data string corresponding to the 16x8 image block, or called a bit string (bitstearm), The arrangement sequence refers to the order from the root pixel, the encoding header of the first pixel group to the encoding header of the seventh pixel group, the residual value of each pixel in the first pixel group to The residual value of each pixel in the seventh pixel group. 依據申請專利範圍第1項所述之無損影像壓縮方法,其中在設定每個該像素群組的編碼表頭時,如果所有該等像素的殘值皆為0,則該編碼表頭為000;在該殘值的絕對值之範圍為0~1時,該編碼表頭為001;在該殘值的絕對值之範圍為0~3時,該編碼表頭為010;在該殘值的絕對值之範圍為0~7時,該編碼表頭為011;在該殘值的絕對值之範圍為0~15時,該編碼表頭為100;在該殘值的絕對值之範圍為0~31時,該編碼表頭為101;在該殘值的絕對值之範圍為0~63時,該編碼表頭為110;在殘值的絕對值之範圍超出0~63時,該編碼表頭為111。 According to the lossless image compression method described in item 1 of the scope of patent application, when the encoding header of each pixel group is set, if the residual value of all the pixels is 0, the encoding header is 000; When the absolute value of the residual value ranges from 0 to 1, the code header is 001; when the absolute value of the residual value ranges from 0 to 3, the code header is 010; in the absolute value of the residual value When the value range is 0~7, the coding header is 011; when the absolute value of the residual value is in the range of 0-15, the coding header is 100; when the absolute value of the residual value is in the range of 0~ At 31 o'clock, the code header is 101; when the absolute value of the residual value is in the range of 0 to 63, the code header is 110; when the absolute value of the residual value exceeds the range of 0 to 63, the code header is Is 111.
TW108120791A 2019-06-14 2019-06-14 Lossless image compression method TWI709326B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW108120791A TWI709326B (en) 2019-06-14 2019-06-14 Lossless image compression method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW108120791A TWI709326B (en) 2019-06-14 2019-06-14 Lossless image compression method

Publications (2)

Publication Number Publication Date
TWI709326B true TWI709326B (en) 2020-11-01
TW202046727A TW202046727A (en) 2020-12-16

Family

ID=74202608

Family Applications (1)

Application Number Title Priority Date Filing Date
TW108120791A TWI709326B (en) 2019-06-14 2019-06-14 Lossless image compression method

Country Status (1)

Country Link
TW (1) TWI709326B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5835034A (en) * 1995-07-18 1998-11-10 Hewlett-Packard Company System and method for lossless image compression
US20020176631A1 (en) * 2001-03-30 2002-11-28 Sharp Laboratories Of America, Inc. High performance lossless compression of grayscale documents
US20090154818A1 (en) * 2007-12-18 2009-06-18 Canon Kabushiki Kaisha Lossless compressor for image data values
CN101715132A (en) * 2008-09-30 2010-05-26 雅马哈株式会社 Lossless compression-encoding device
CN102271251A (en) * 2010-06-02 2011-12-07 华晶科技股份有限公司 Lossless image compression method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5835034A (en) * 1995-07-18 1998-11-10 Hewlett-Packard Company System and method for lossless image compression
US20020176631A1 (en) * 2001-03-30 2002-11-28 Sharp Laboratories Of America, Inc. High performance lossless compression of grayscale documents
US20090154818A1 (en) * 2007-12-18 2009-06-18 Canon Kabushiki Kaisha Lossless compressor for image data values
CN101715132A (en) * 2008-09-30 2010-05-26 雅马哈株式会社 Lossless compression-encoding device
CN102271251A (en) * 2010-06-02 2011-12-07 华晶科技股份有限公司 Lossless image compression method

Also Published As

Publication number Publication date
TW202046727A (en) 2020-12-16

Similar Documents

Publication Publication Date Title
US10182244B2 (en) Fast encoding loss metric
TWI536811B (en) Method and system for image processing, decoding method, encoder and decoder
WO2021114846A1 (en) Video noise cancellation processing method and apparatus, and storage medium
US10051272B2 (en) Coding structure
JP6773659B2 (en) Methods and equipment for decoding color pictures
US20180309991A1 (en) Video encoding with adaptive rate distortion control by skipping blocks of a lower quality video into a higher quality video
US10616498B2 (en) High dynamic range video capture control for video transmission
TWI634780B (en) Method and apparatus for image compression using block prediction mode
TWI551124B (en) Encoding, decoding method and encoding, decoding apparatus for video system
KR20210132708A (en) Loop filtering implementation method, apparatus and computer storage medium
US20180084279A1 (en) Video encoding by injecting lower-quality quantized transform matrix values into a higher-quality quantized transform matrix
US10757424B2 (en) FLC-based image compression method and device
CN107105240B (en) HEVC-SCC complexity control method and system
TWI505717B (en) Joint scalar embedded graphics coding for color images
JP2010098352A (en) Image information encoder
TWI709326B (en) Lossless image compression method
JP6194334B2 (en) Video encoding apparatus, video encoding method, and video encoding program
US8213520B2 (en) Compression method for display frames of QFHD (quad full high definition) resolution and system thereof
CN106954074B (en) Video data processing method and device
US11825088B2 (en) Adaptively encoding video frames based on complexity
TWI700918B (en) Coding of video and audio with initialization fragments
CN109618155A (en) Compaction coding method
WO2024051299A1 (en) Encoding method and apparatus, and decoding method and apparatus
CN107277508B (en) Pixel-level bidirectional intra-frame prediction method adopting self-adaptive mode selection
CN105763826A (en) Video data input method, video data output method, video data input device, and video data output device