TWI580252B - Line and block integrated transform method and computer-readable storage medium thereof - Google Patents

Line and block integrated transform method and computer-readable storage medium thereof Download PDF

Info

Publication number
TWI580252B
TWI580252B TW102143912A TW102143912A TWI580252B TW I580252 B TWI580252 B TW I580252B TW 102143912 A TW102143912 A TW 102143912A TW 102143912 A TW102143912 A TW 102143912A TW I580252 B TWI580252 B TW I580252B
Authority
TW
Taiwan
Prior art keywords
horizontal
block
address
pixel
memory
Prior art date
Application number
TW102143912A
Other languages
Chinese (zh)
Other versions
TW201521008A (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 TW102143912A priority Critical patent/TWI580252B/en
Publication of TW201521008A publication Critical patent/TW201521008A/en
Application granted granted Critical
Publication of TWI580252B publication Critical patent/TWI580252B/en

Links

Description

行與區塊之整合轉換方法與電腦可讀取儲存媒體 Line and block integration conversion method and computer readable storage medium

本發明關於一種影像處理方法,特別是指一種行與區塊之整合轉換方法以提高記憶體之使用率。 The present invention relates to an image processing method, and more particularly to an integrated conversion method for rows and blocks to improve memory usage.

數位影像應用的快速發展,包括小規模出版業,多媒體、視訊會議、及高清晰度電視(HDTV)等,增加了對於有效率且標準化的影像壓縮技術之需要。若沒有影像壓縮,則影像的傳輸所耗用的頻寬可能是許多應用無法支援的。影像壓縮方法將由2次元畫素陣列的影像轉換為一序列的位元,並透過傳輸連線傳送之。每一個畫素表示該影像在一特定位置的強度。影像在數位電路的傳輸過程中,畫素一般是按照從左往右,自上而下逐行傳輸的順序。當在數位影像進行壓縮時,通常要先把畫素按照方塊進行排列。例如JPEG是分成8×8的方塊,H.264是分成16×16的方塊,因此,這就需要用到行(line)與區塊(block)的轉換。如果用數位電路來實現,則需要較大的記憶體來緩衝儲存資料。 The rapid development of digital imaging applications, including small-scale publishing, multimedia, video conferencing, and high definition television (HDTV), has increased the need for efficient and standardized image compression techniques. Without image compression, the bandwidth used for image transmission may be unsupported by many applications. The image compression method converts the image from the 2D pixel array into a sequence of bits and transmits it through the transmission line. Each pixel represents the intensity of the image at a particular location. During the transmission of an image in a digital circuit, the pixels are generally transmitted in order from left to right and from top to bottom. When compressing a digital image, it is usually necessary to arrange the pixels in blocks. For example, JPEG is divided into 8×8 squares, and H.264 is divided into 16×16 squares. Therefore, it is necessary to use a line and a block conversion. If implemented with a digital circuit, larger memory is required to buffer the stored data.

在先前技術下,用數位電路來實現從行到區塊的轉換,常用的方法是採用ping-pong的方式。假設區塊為16x16,影像寬度為W,高度為H,並且每個畫素用1個位元組表示,則轉換過程中所需要的記憶體儲存空間為32×W。先前技術下的記憶體被分為上下兩部分,每個部分都正好可以存放16行的畫素。首先第1~16行畫 素會按照輸入順序寫入到記憶體的上半部分,然後第17~32行的畫素再寫入到記憶體的下半部分,同時按照區塊的順序讀取出記憶體中上半部分的資料,並且讀取和寫入的速度相同。當記憶體的下半部分被讀取完後,記憶體的上半部分的資料也會被讀取走,然後再把第33~48行資料寫入到記憶體的上半部分,同時以會讀取memory中的下半部分的資料,後續資料以此方式重複進行。因此,用ping-pong的方式來進行行和區塊的轉換,雖然實現方式簡單,但是記憶體的利用率不高。 In the prior art, digital circuits are used to implement the conversion from row to block. The common method is to use ping-pong. Assuming that the block is 16x16, the image width is W, the height is H, and each pixel is represented by 1 byte, the memory storage space required for the conversion process is 32×W. The memory of the prior art is divided into upper and lower parts, and each part can store 16 lines of pixels. First line 1~16 The primes are written to the upper half of the memory in the order of input, and then the pixels of lines 17 to 32 are written to the lower half of the memory, and the upper half of the memory is read in the order of the blocks. The data is the same as reading and writing. When the lower half of the memory is read, the data of the upper part of the memory will be read, and then the data of the 33th to 48th lines will be written to the upper part of the memory. Read the data in the lower part of the memory, and the subsequent data is repeated in this way. Therefore, the ping-pong method is used to perform row and block conversion. Although the implementation is simple, the memory utilization is not high.

本發明實施例提供一種用於一影像之行與區塊之整合轉換方法,行與區塊之整合轉換方法包括以下步驟:將影像分割為M個水平區塊與N個垂直區塊;依序地將多個水平區塊中的第一水平區塊之多個第一畫素單元之位址根據記憶體之累加位址之順序寫入記憶體;從記憶體中每間隔畫素預定距離來循環地讀取多個第一畫素單元之位址,其中所述畫素預定距離為影像之寬度;透過雙迴圈演算法來獲得多個第X-1畫素單元之位置以循序地讀取第X-1水平區塊之多個第X-1畫素單元之位址;以及,當每間隔畫素預定距離來循環地讀取記憶體之多個第X-1畫素單元之位址時,將多個水平區塊中的第X水平區塊之多個第X畫素單元之位址循環地每間隔畫素預定距離隨後地寫入記憶體。多個水明區塊與多個垂直區塊之劃分形成M×N矩陣,其中矩陣中的每一元素大小為B×B矩陣,並且第一畫素單元與該些第X畫素單元包括B個畫素,其中B、M與N為正整數並且N為該影像之寬度除以B。 An embodiment of the present invention provides an integrated conversion method for an image line and a block. The method for integrating a line and a block includes the following steps: dividing the image into M horizontal blocks and N vertical blocks; Addressing the addresses of the plurality of first pixel units of the first horizontal block of the plurality of horizontal blocks into the memory according to the order of the accumulated addresses of the memory; from the predetermined distance of each interval pixel in the memory Cyclicly reading the addresses of the plurality of first pixel units, wherein the predetermined distance of the pixels is the width of the image; and the positions of the plurality of X-1 pixel units are obtained through the double loop algorithm to sequentially read Taking the addresses of the plurality of X-1 pixel units of the X-1 horizontal block; and reading the positions of the plurality of X-1 pixel units of the memory cyclically by a predetermined distance per interval pixel At the time of address, the addresses of the plurality of Xth pixel units of the Xth horizontal block in the plurality of horizontal blocks are cyclically written to the memory by a predetermined distance per interval. The partitioning of the plurality of waterblocks and the plurality of vertical blocks forms an M×N matrix, wherein each element in the matrix is a B×B matrix, and the first pixel unit and the Xth pixel units include B Pixels, where B, M, and N are positive integers and N is the width of the image divided by B.

本發明實施例另提供一種電腦可讀取儲存媒體,用以儲存電腦程式,上述電腦程式包括複數程式碼,其用以載入至電子裝置並且使得電子裝置執行用於一影像之一種行與區塊之整合轉換方法,行與區塊之整合轉換方法包括以下步驟:將影像分割為M個水 平區塊與N個垂直區塊;依序地將多個水平區塊中的第一水平區塊之多個第一畫素單元之位址根據記憶體之累加位址之順序寫入記憶體;從記憶體中每間隔畫素預定距離來循環地讀取多個第一畫素單元之位址,其中所述畫素預定距離為影像之寬度;透過雙迴圈演算法來獲得多個第X-1畫素單元之位置以循序地讀取第X-1水平區塊之多個第X-1畫素單元之位址;以及,當每間隔畫素預定距離來循環地讀取記憶體之多個第X-1畫素單元之位址時,將多個水平區塊中的第X水平區塊之多個第X畫素單元之位址循環地每間隔畫素預定距離隨後地寫入記憶體。多個水平區塊與多個垂直區塊形成M×N矩陣,每一矩陣之大小為B×B,並且第一畫素單元與該些第X畫素單元包括B個畫素,其中B、M與N為正整數並且N為該影像之寬度除以B。 Another embodiment of the present invention provides a computer readable storage medium for storing a computer program. The computer program includes a plurality of code codes for loading into an electronic device and causing the electronic device to execute a line and area for an image. The integrated conversion method of the block, the integrated conversion method of the row and the block includes the following steps: dividing the image into M waters a flat block and N vertical blocks; sequentially injecting addresses of the plurality of first pixel units of the first horizontal block of the plurality of horizontal blocks into the memory according to the order of the accumulated addresses of the memory And cyclically reading addresses of the plurality of first pixel units from a predetermined distance of each of the pixels in the memory, wherein the predetermined distance of the pixels is the width of the image; and the plurality of frames are obtained by the double loop algorithm The position of the X-1 pixel unit sequentially reads the addresses of the plurality of X-1 pixel units of the X-1 horizontal block; and cyclically reads the memory when the interval is a predetermined distance per pixel When the addresses of the plurality of X-1 pixel units are located, the addresses of the plurality of Xth pixel units of the Xth horizontal block in the plurality of horizontal blocks are cyclically written by a predetermined distance per interval pixel Into the memory. The plurality of horizontal blocks and the plurality of vertical blocks form an M×N matrix, each matrix has a size of B×B, and the first pixel unit and the Xth pixel units include B pixels, wherein B, M and N are positive integers and N is the width of the image divided by B.

綜上所述,本發明實施例所提出之行與區塊之整合轉換方法與電腦可讀取儲存媒體,透過行轉換方式將影像之第一畫素單元與第X畫素單元寫入記憶體,並且透過區塊轉換方式來讀取儲存於記憶體之第一畫素單元與第X畫素單元,據此以提升記憶體之使用率,亦即相較於先前技術的ping-pong方式,本揭露內容能夠節省約一半的記憶體的儲存空間,進而能夠達到大幅降低數位電路之實施成本之功效。 In summary, the method for converting the line and the block proposed by the embodiment of the present invention and the computer readable storage medium, the first pixel unit and the X pixel unit of the image are written into the memory by line conversion. And reading the first pixel unit and the X pixel unit stored in the memory by using a block conversion method, thereby increasing the usage rate of the memory, that is, compared to the ping-pong method of the prior art. The disclosure can save about half of the storage space of the memory, thereby achieving the effect of greatly reducing the implementation cost of the digital circuit.

為使能更進一步瞭解本發明之特徵及技術內容,請參閱以下有關本發明之詳細說明與附圖,但是此等說明與所附圖式僅係用來說明本發明,而非對本發明的權利範圍作任何的限制。 The detailed description of the present invention and the accompanying drawings are to be understood by the claims The scope is subject to any restrictions.

100‧‧‧影像 100‧‧‧ images

EVM‧‧‧記憶體 EVM‧‧‧ memory

H‧‧‧高度 H‧‧‧ Height

HB_0~HB_M-1‧‧‧水平區塊 HB_0~HB_M-1‧‧‧ horizontal block

L1~LB‧‧‧行 L1~LB‧‧‧

pu1、pu2、puX‧‧‧畫素單元 Pu1, pu2, puX‧‧‧ pixel unit

S310、S320、S330、S340、S350‧‧‧步驟 S310, S320, S330, S340, S350‧‧‧ steps

S402、S404、S406、S408、S410、S412、S414、S416、S418、 S420、S422、S424、S426‧‧‧步驟 S402, S404, S406, S408, S410, S412, S414, S416, S418, S420, S422, S424, S426‧‧ steps

VB_0~VB_N-1‧‧‧垂直區塊 VB_0~VB_N-1‧‧‧ vertical block

W‧‧‧寬度 W‧‧‧Width

圖1為根據本發明例示性實施例所繪示之行與區塊之整合轉換方法之示意圖。 FIG. 1 is a schematic diagram of a method for integrating rows and blocks according to an exemplary embodiment of the present invention.

圖2A與圖2B為根據本發明例示性實施例所繪示之將影像行轉換寫入至記憶體之示意圖。 2A and 2B are schematic diagrams of writing image line conversion to a memory according to an exemplary embodiment of the invention.

圖3為根據本發明例示性實施例所繪示之行與區塊之整合轉換方法之流程圖。 FIG. 3 is a flow chart of a method for integrating rows and blocks according to an exemplary embodiment of the present invention.

圖4為根據本發明例示性另一實施例所繪示之行與區塊之整合轉換方法之流程圖。 4 is a flow chart of a method for integrating rows and blocks according to an exemplary embodiment of the present invention.

在下文將參看隨附圖式更充分地描述各種例示性實施例,在隨附圖式中展示一些例示性實施例。然而,本發明概念可能以許多不同形式來體現,且不應解釋為限於本文中所闡述之例示性實施例。 Various illustrative embodiments are described more fully hereinafter with reference to the accompanying drawings. However, the inventive concept may be embodied in many different forms and should not be construed as being limited to the illustrative embodiments set forth herein.

影像在數位電路的傳輸過程中,畫素一般是按照從左往右,自上而下逐行傳輸的順序。當在數位影像進行壓縮時,通常要先把畫素按照方塊進行排列。例如JPEG是分成8×8的方塊,H.264是分成16×16的方塊,因此,這就需要用到行(line)與區塊(block)的轉換。如果用數位電路來實現,則需要較大的記憶體來緩衝儲存資料。本揭露內容提出了一種優良的記憶體利用方法以降低記憶體中所需之儲存空間,進而提高記憶體之使用率。 During the transmission of an image in a digital circuit, the pixels are generally transmitted in order from left to right and from top to bottom. When compressing a digital image, it is usually necessary to arrange the pixels in blocks. For example, JPEG is divided into 8×8 squares, and H.264 is divided into 16×16 squares. Therefore, it is necessary to use a line and a block conversion. If implemented with a digital circuit, larger memory is required to buffer the stored data. The present disclosure proposes an excellent memory utilization method to reduce the storage space required in the memory, thereby improving the memory usage.

〔行與區塊之整合轉換方法的實施例〕 [Example of integrated conversion method of row and block]

請參照圖1,圖1為根據本發明例示性實施例所繪示之行與區塊之整合轉換方法之示意圖。在進行下述說明前,須先說明的是,影像的寬度定義為W,並且影像之高度定義為H。如圖1所示,在進行影像或視訊(序列影像)資料壓縮過程中,影像100會被分割為M個水平區塊HB_0~HB_M-1與N個垂直區塊VB_0~VB_N-1,其中多個水平區塊HB_0~HB_M-1與多個垂直區塊VB_0~VB_N-1會形成一M×N矩陣,每一個矩陣之大小為B×B。再者,每一個矩陣具有B×B個畫素並且每個畫素具有一個位元組之數據資料。須注意的是,在本實施例中,每16個畫素定義為一個畫素單元,因此整張影像100會先予以座標化並且影像座標之解析度為畫素單 元(每一矩陣具有B個畫素單元)。如圖1所示,多個第一畫素單元pu1為沿著多個水平區塊HB_0~HB_M-1之第一水平區塊HB_0之水平方向循序地被定義,依此類推,多個第X畫素單元puX為沿著多個水平區塊HB_0~HB_M-1之第X水平區塊HB_X(X-1)之水平方向循序地被定義,其中B、M與N為正整數並且N為影像之寬度除以B,並且X為位於2與M之間的正整數。 Please refer to FIG. 1. FIG. 1 is a schematic diagram of a method for integrating rows and blocks according to an exemplary embodiment of the present invention. Before making the following description, it must be stated that the width of the image is defined as W, and the height of the image is defined as H. As shown in FIG. 1, during image or video (sequence image) data compression, image 100 is divided into M horizontal blocks HB_0~HB_M-1 and N vertical blocks VB_0~VB_N-1, among which The horizontal blocks HB_0~HB_M-1 and the plurality of vertical blocks VB_0~VB_N-1 form an M×N matrix, and each matrix has a size of B×B. Furthermore, each matrix has B x B pixels and each pixel has one byte of data. It should be noted that in this embodiment, every 16 pixels are defined as one pixel unit, so the entire image 100 is first coordinated and the resolution of the image coordinates is a pixel. Yuan (each matrix has B pixel units). As shown in FIG. 1, the plurality of first pixel units pu1 are sequentially defined along the horizontal direction of the first horizontal block HB_0 of the plurality of horizontal blocks HB_0~HB_M-1, and so on, a plurality of Xth The pixel unit puX is sequentially defined along the horizontal direction of the Xth horizontal block HB_X(X-1) of the plurality of horizontal blocks HB_0~HB_M-1, wherein B, M and N are positive integers and N is an image The width is divided by B, and X is a positive integer between 2 and M.

接下來將進一步說明行與區塊之整合轉換方法的轉換機制。簡單來說,本揭露內容透過行轉換方式來將影像100之多個第一畫素單元pu1與多個第X畫素單元puX寫入記憶體EVM,並且透過區塊轉換方式來讀取儲存於記憶體EVM之多個第一畫素單元pu1與多個第X畫素單元puX,以進行影像資料壓縮工作。 Next, the conversion mechanism of the integrated conversion method of rows and blocks will be further explained. Briefly, the present disclosure writes a plurality of first pixel units pu1 and a plurality of X pixel units puX of the image 100 into the memory EVM through a line conversion method, and reads and stores the data in the block conversion mode. The plurality of first pixel units pu1 and the plurality of Xth pixel units puX of the memory EVM perform image data compression work.

請同時參照圖1~圖3,圖2A與圖2B為根據本發明例示性實施例所繪示之將影像行轉換寫入至記憶體之示意圖。圖3為根據本發明例示性實施例所繪示之行與區塊之整合轉換方法之流程圖。行與區塊之整合轉換方法包括以下步驟:將影像100分割為M個水平區塊與N個垂直區塊(步驟S310)。依序地將多個水平區塊HB_0~HB_M-1中的第一水平區塊HB_0之多個第一畫素單元pu1之位址根據一記憶體EVM之累加位址之順序寫入記憶體EVM(步驟S320)。從記憶體EVM中每間隔畫素預定距離來循環地讀取多個第一畫素單元pu1之位址,其中畫素預定距離為影像之寬度W(步驟S330)。透過雙迴圈演算法來獲得多個第X畫素單元之位置以循序地讀取第X水平區塊HB_X之多個第X畫素單元之位址(步驟S340)。當每間隔畫素預定距離來循環地讀取記憶體之多個第X畫素單元之位址時,將多個水平區塊HB_0~HB_M-1中的第X+1水平區塊HB_X之多個第X+1畫素單元之位址循環地每間隔畫素預定距離隨後地寫入記憶體EVM(步驟S350)。在此,先以影像100之第1~16行之資料(亦即水平區塊HB_0之資料)為範例予以說明,以更清楚了解本揭露內容。在本實施例中,如圖2A與圖2B所示,每一 個第一畫素單元pu1分別定義為0~(B×N)-1,其中0~N-1定義為第一行L1;依此類推,(B-1)×N~(B×N)-1定義為第B行LB,並且於本實施例中,B等於16。 Please refer to FIG. 1 to FIG. 3 simultaneously. FIG. 2A and FIG. 2B are schematic diagrams showing the conversion of image lines to a memory according to an exemplary embodiment of the present invention. FIG. 3 is a flow chart of a method for integrating rows and blocks according to an exemplary embodiment of the present invention. The row and block integration conversion method includes the steps of dividing the image 100 into M horizontal blocks and N vertical blocks (step S310). The addresses of the plurality of first pixel units pu1 of the first horizontal block HB_0 of the plurality of horizontal blocks HB_0~HB_M-1 are sequentially written into the memory EVM according to the order of the accumulated addresses of the memory EVM. (Step S320). The addresses of the plurality of first pixel units pu1 are cyclically read from a predetermined distance per interval of the memory EVM, wherein the predetermined distance of the pixels is the width W of the image (step S330). The position of the plurality of Xth pixel units is obtained by the double loop algorithm to sequentially read the addresses of the plurality of Xth pixel units of the Xth horizontal block HB_X (step S340). When the address of the plurality of Xth pixel units of the memory is cyclically read by a predetermined distance per interval, the number of the X+1 horizontal blocks HB_X of the plurality of horizontal blocks HB_0~HB_M-1 is increased. The addresses of the X+1th pixel units are cyclically written to the memory EVM every predetermined interval of the interval pixels (step S350). Here, the data of the first to the 16th lines of the image 100 (that is, the data of the horizontal block HB_0) will be described as an example to better understand the present disclosure. In this embodiment, as shown in FIG. 2A and FIG. 2B, each The first pixel units pu1 are respectively defined as 0~(B×N)-1, where 0~N-1 is defined as the first line L1; and so on, (B-1)×N~(B×N) -1 is defined as the Bth line LB, and in the present embodiment, B is equal to 16.

在步驟S320中,影像100的第一行L1之第一畫素單元pu1(亦即0~N-1)會依序地根據記憶體EVM之累加位址之順序寫入記憶體EVM以完成行轉換。接著,影像100的第二行L2之第一畫素單元pu1(亦即N~2N-1)會依序地根據記憶體EVM之累加位址之順序寫入,同理,影像100的第B行LB之第一畫素單元pu1(亦即(B-1)×N~(B×N)-1)會依序地根據記憶體EVM之累加位址之順序寫入記憶體EVM。此時,記憶體EVM之整體儲存空間等於水平區塊HB_0之儲存空間。在透過本揭露內容之行與區塊之整合轉換方法,記憶體EVM僅需要第一水平區塊HB_0之儲存空間即能夠使用(亦即B×W),因此相較於先前技術,本揭露內容能夠節省記憶體一半的儲存空間,藉此提高記憶體之使用率,亦即先前技術之記憶體之儲存空間需要32×W,然而本揭露內容之記憶體之儲存空間僅需要16×W。接下來,會再更清楚說明行與區塊之整合轉換方法之相關細節。 In step S320, the first pixel unit pu1 (ie, 0~N-1) of the first line L1 of the image 100 is sequentially written into the memory EVM according to the order of the accumulated addresses of the memory EVM to complete the line. Conversion. Then, the first pixel unit pu1 (that is, N~2N-1) of the second line L2 of the image 100 is sequentially written according to the order of the accumulated addresses of the memory EVM. Similarly, the B of the image 100 The first pixel unit pu1 of the line LB (i.e., (B-1) x N~(B x N)-1) is sequentially written to the memory EVM in accordance with the order of the accumulated addresses of the memory EVM. At this time, the overall storage space of the memory EVM is equal to the storage space of the horizontal block HB_0. In the integrated conversion method of the content and the block of the disclosure, the memory EVM only needs the storage space of the first horizontal block HB_0 to be used (that is, B×W), so compared with the prior art, the disclosure content The storage space of half of the memory can be saved, thereby increasing the usage rate of the memory, that is, the storage space of the memory of the prior art needs 32×W, but the storage space of the memory of the disclosure only needs 16×W. Next, we will more clearly explain the details of the integrated conversion method between rows and blocks.

在步驟S330中,每間隔一畫素預定距離來循環地讀取記憶體EVM中的多個第一畫素單元pu1之位址以完成區塊轉換,值得注意的是,畫素預定距離為影像100之寬度。進一步來說,記憶體EVM中的多個第一畫素單元pu1(亦即0、N、2N、3N~(B-1)×N)會依序地被讀取出來,接下來,記憶體EVM中的多個第一畫素單元pu1(亦即1、N+1、2N+1、3N+1~(B-1)×N+1)會依序地被讀取出來。依此類推,記憶體EVM中的多個第一畫素單元pu1(亦即N-1、2N-1、3N-1~B×N-1)會依序地被讀取出來。值得一提的是,當多個第一畫素單元pu1(亦即0、N、2N、3N~(B-1)×N)會依序地被讀取出來以釋放儲存空間時,第二水平區塊HB_1之第一行之多個第二畫素單元pu2會依序地寫入多個第一畫素單元pu1(亦即0、N、2N、3N~ (B-1)×N)之原本儲存空間。依此類推,當多個第一畫素單元pu1(亦即N-1、2N-1、3N-1~B×N-1)會依序地被讀取出來以釋放儲存空間時,第二水平區塊HB_1之第B行之多個第二畫素單元pu2會依序地寫入多個第一畫素單元pu1(亦即0、N、2N、3N~(B-1)×N)之原本儲存空間,以同時進行行轉換與區塊轉換(可從影像100之觀點來看以更了解本揭露內容之區塊轉換之方式)。 In step S330, the address of the plurality of first pixel units pu1 in the memory EVM is cyclically read every predetermined interval of one pixel to complete the block conversion. It is worth noting that the predetermined distance of the pixels is the image. The width of 100. Further, a plurality of first pixel units pu1 (ie, 0, N, 2N, 3N~(B-1)×N) in the memory EVM are sequentially read, and then, the memory A plurality of first pixel units pu1 (ie, 1, N+1, 2N+1, 3N+1~(B-1)×N+1) in the EVM are sequentially read. By analogy, a plurality of first pixel units pu1 (i.e., N-1, 2N-1, 3N-1~B×N-1) in the memory EVM are sequentially read. It is worth mentioning that when a plurality of first pixel units pu1 (ie, 0, N, 2N, 3N~(B-1)×N) are sequentially read out to release the storage space, the second The plurality of second pixel units pu2 in the first row of the horizontal block HB_1 sequentially write the plurality of first pixel units pu1 (ie, 0, N, 2N, 3N~) (B-1) × N) The original storage space. And so on, when a plurality of first pixel units pu1 (ie, N-1, 2N-1, 3N-1~B×N-1) are sequentially read out to release the storage space, the second The plurality of second pixel units pu2 of the Bth row of the horizontal block HB_1 sequentially write the plurality of first pixel units pu1 (ie, 0, N, 2N, 3N~(B-1)×N). The original storage space for simultaneous row conversion and block conversion (from the perspective of image 100 to better understand the manner of block conversion of the present disclosure).

在步驟S340中,透過雙迴圈演算法來獲得多個第X畫素單元puX之位置以循序地讀取第X水平區塊HB_X之多個第X畫素單元puX之位址。在本實施例中,透過行與區塊之整合轉換方法來先將影像100予以座標化(其中每一水平區塊之畫素單元之座標化是相同的)。舉例來說,第一水平區塊HB_0之第一畫素單元pu1之座標定位(0~(B×N)-1)與第二水平區塊HB_1之第二畫素單元pu2之座標定位(0~(B×N)-1)相同,其它水平區塊(例如HB_2~HB_X-1)也是同理。在本實施例中,影像100可以視為由多個水平區塊HB_0~HB_M-1構成,每一個水平區塊(例如HB_0)是由第一至B行L1~LB所構成,並且每一行(例如L1)是由多個第一畫素單元pu1所構成。在本揭露內容中,由於影像100是根據水平區塊HB_0~HB_M-1之順序來進行行轉換,並且儲存至記憶體EVM,因此需要進一步詳細算出影像100之每一個畫素單元之座標位置以擷取其位址。 In step S340, the positions of the plurality of Xth pixel units puX are obtained by the double loop algorithm to sequentially read the addresses of the plurality of Xth pixel units puX of the Xth horizontal block HB_X. In this embodiment, the image 100 is first normalized by a row-to-block integration conversion method (where the coordinate units of each horizontal block are the same). For example, the coordinate positioning of the first pixel unit pu1 of the first horizontal block HB_0 (0~(B×N)-1) and the coordinate positioning of the second pixel unit pu2 of the second horizontal block HB_1 (0) ~(B×N)-1) is the same, and other horizontal blocks (such as HB_2~HB_X-1) are the same. In this embodiment, the image 100 can be regarded as being composed of a plurality of horizontal blocks HB_0~HB_M-1, and each horizontal block (for example, HB_0) is composed of the first to B lines L1 to LB, and each line ( For example, L1) is composed of a plurality of first pixel units pu1. In the disclosure, since the image 100 is converted in the order of the horizontal blocks HB_0~HB_M-1 and stored in the memory EVM, it is necessary to further calculate the coordinate position of each pixel unit of the image 100 in detail. Please select its address.

在步驟S350中,當儲存於記憶體EVM中的第二水平區塊HB_1之多個第二畫素單元pu2被依序讀取出來以釋放出儲存空間時,影像100中的第三水平區塊HB_2之多個第三畫素單元pu3會被依序地寫入多個第二畫素單元pu2在記憶體EVM之原本儲存空間。依此類推,當儲存於記憶體EVM中的第M-1水平區塊HB_M-2之多個第M-1畫素單元被依序讀取出來以釋放出儲存空間時,影像100中的第M水平區塊HB_M-1之多個第M畫素單元會被依序地寫入多個第M-1畫素單元在記憶體EVM之原本儲存空間,據此以同時完成行轉 換與區塊轉換之工作。值得一提的是,本揭露內容之影像100在進行行與區塊之整合轉換工作時,讀取位址速度較佳地要大於或等於寫入位址速度,以避免覆蓋到記憶體EVM之儲存資料。 In step S350, when the plurality of second pixel units pu2 of the second horizontal block HB_1 stored in the memory EVM are sequentially read out to release the storage space, the third horizontal block in the image 100 The plurality of third pixel units pu3 of HB_2 are sequentially written into the original storage space of the plurality of second pixel units pu2 in the memory EVM. And so on, when the plurality of M-1 pixel units of the M-1 horizontal block HB_M-2 stored in the memory EVM are sequentially read out to release the storage space, the image 100 The plurality of Mth pixel units of the M horizontal block HB_M-1 are sequentially written into the original storage space of the plurality of M-1 pixel units in the memory EVM, thereby completing the transfer at the same time. Switch to block conversion work. It is worth mentioning that, when the image 100 of the present disclosure performs the integrated conversion operation of the row and the block, the read address speed is preferably greater than or equal to the write address speed to avoid overwriting to the memory EVM. Store data.

簡單來說,在本揭露內容中,影像100中的第一水平區塊HB_0之多個第一畫素單元pu1為按照順序寫入至記憶體EVM之儲存空間內,影像100中的其它水平區塊HB_X(例如HB_1~HB_M-1其中之一)之多個第X畫素單元puX寫入記憶體EVM之順序相同於從記憶體EVM中讀取水平區塊HB_X-1之多個第X-1畫素單元puX-1之順序。 Briefly, in the disclosure, the plurality of first pixel units pu1 of the first horizontal block HB_0 in the image 100 are sequentially written into the storage space of the memory EVM, and other horizontal areas in the image 100. The order of the plurality of X-th pixel units puX of the block HB_X (for example, one of HB_1~HB_M-1) is written in the memory EVM is the same as the reading of the plurality of X-th of the horizontal block HB_X-1 from the memory EVM. The order of 1 pixel unit puX-1.

為了更詳細地說明本發明所述之雙迴圈演算法的相關細節,以下將舉多個實施例中至少之一來作更進一步的說明。 In order to explain in more detail the details of the double loop algorithm of the present invention, at least one of the various embodiments will be further described below.

在接下來的多個實施例中,將描述不同於上述實施例之部分,且省略其餘與上述實施例相同或類似之部分。此外,為說明便利起見,相似之參考數字或標號指示相似之元件。 In the following various embodiments, portions different from the above-described embodiments will be described, and the remaining portions that are the same as or similar to the above-described embodiments will be omitted. In addition, for the sake of convenience, like reference numerals or numerals indicate similar elements.

〔行與區塊之整合轉換方法的另一實施例〕 [Another embodiment of a method for integrating rows and blocks]

請同時參照圖1~圖4,圖4為根據本發明例示性另一實施例所繪示之行與區塊之整合轉換方法之流程圖。以下將進一步說明雙迴圈演算法以便更了解計算影像100之畫素單元之座標的方式,而在進入雙迴圈演算法之前,行與區塊之整合轉換方法更包括以下步驟:初始化垂直迴圈參數(步驟S402)與初始化動態讀址函數(步驟S404)。雙迴圈演算法包括以下步驟:透過垂直迴圈參數來判斷是否超出垂直區塊之範圍(步驟S406)。如果垂直迴圈參數尚未超出垂直區塊的範圍,則初始化水平迴圈參數與固定讀址函數(步驟S408與步驟S410)。透過水平迴圈參數來判斷是否超出水平區塊之範圍(步驟S412)。如果水平迴圈參數尚未超出水平區塊之範圍,則透過固定讀址函數與動態讀址函數來獲得畫素單元位址(步驟S414),並且進入決策判斷(步驟S416)。接下來,透過該決策判斷,如果畫素單元位址尚未超出水平區塊之範圍,則將畫素單元位址 儲存至下一個固定讀址函數(步驟S418)。如果畫素單元位址超出水平區塊之範圍,則將畫素單元位址減去水平區塊之範圍之最大值後儲存至下一個固定讀址函數(步驟S420)。將水平迴圈參數加一,並且回到判斷水平迴圈參數是否超出水平區塊之範圍之步驟(步驟S422)。如果水平迴圈參數超出水平區塊之範圍,則執行下一個動態讀址函數(步驟S424)。將垂直迴圈參數加一,並且回到判斷垂直迴圈參數是否超出垂直區塊之範圍之步驟(步驟S426)。接下來,將詳細說明圖4實施例之各步驟流程,並且有需要時請同時參照以下之核心程式碼,其中符號j表示垂直迴圈參數,符號i表示水平迴圈參數,而固定讀址函數與下一個固定讀址函數分別為reading address(i)與reading address(i+1),並且下一個動態讀址函數為D(j+1)=div(D(j),B)+mod(D(j),B)×N,其中div(D(j),B)為將動態讀址函數與B進行整數運算,並且mod(D(j),B)為將動態讀址函數與B進行餘數運算。 Please refer to FIG. 1 to FIG. 4 simultaneously. FIG. 4 is a flowchart of a method for integrating rows and blocks according to an exemplary embodiment of the present invention. The following will further explain the double loop algorithm to better understand the way of calculating the coordinates of the pixel unit of the image 100. Before entering the double loop algorithm, the row and block integration conversion method further includes the following steps: initializing the vertical back The circle parameter (step S402) and the initialization dynamic address function (step S404). The double loop algorithm includes the following steps: determining whether the range of the vertical block is exceeded by the vertical loop parameter (step S406). If the vertical loop parameter has not exceeded the range of the vertical block, the horizontal loop parameter and the fixed address function are initialized (steps S408 and S410). Whether or not the range of the horizontal block is exceeded is determined by the horizontal loop parameter (step S412). If the horizontal loop parameter has not exceeded the range of the horizontal block, the pixel unit address is obtained through the fixed address function and the dynamic address function (step S414), and the decision decision is entered (step S416). Next, through the decision, if the pixel unit address has not exceeded the range of the horizontal block, the pixel unit address will be The next fixed address function is stored (step S418). If the pixel unit address is outside the range of the horizontal block, the pixel unit address is subtracted from the maximum value of the horizontal block and stored in the next fixed address function (step S420). The horizontal loop parameter is incremented by one and returned to the step of determining whether the horizontal loop parameter exceeds the range of the horizontal block (step S422). If the horizontal loop parameter exceeds the range of the horizontal block, the next dynamic address function is executed (step S424). The vertical loop parameter is incremented by one and returned to the step of determining whether the vertical loop parameter exceeds the range of the vertical block (step S426). Next, the flow of each step of the embodiment of FIG. 4 will be described in detail, and when necessary, please refer to the following core code, where the symbol j represents a vertical loop parameter, the symbol i represents a horizontal loop parameter, and the fixed address function. The next fixed addressing function is reading address(i) and reading address(i+1), and the next dynamic addressing function is D(j+1)=div(D(j),B)+mod( D(j), B)×N, where div(D(j), B) is an integer operation of the dynamic addressing function with B, and mod(D(j), B) is the dynamic addressing function with B Perform the remainder operation.

[核心程式碼] [core code]

在步驟S402中,在本實施例中,影像100具有多個水平區塊HB_0~HB_M-1,並且影像100是根據水平區塊HB_0~HB_M-1之順序寫入至記憶體EVM,則需要先初始化垂直迴圈參數為零。進一步來說,影像100之水平區塊HB_0被定義為垂直迴圈參數為零;依此類推,影像100之水平區塊HB_M-1被定義為垂直迴圈參數為M-1,亦即垂直迴圈參數為0~M-1,其中M為影像之高度(H)除以B。 In step S402, in the embodiment, the image 100 has a plurality of horizontal blocks HB_0~HB_M-1, and the image 100 is written to the memory EVM according to the order of the horizontal blocks HB_0~HB_M-1, Initialize the vertical loop parameter to zero. Further, the horizontal block HB_0 of the image 100 is defined as a vertical loop parameter of zero; and so on, the horizontal block HB_M-1 of the image 100 is defined as a vertical loop parameter of M-1, that is, vertical back. The circle parameter is 0~M-1, where M is the height of the image (H) divided by B.

在步驟S404中,由於本實施例之讀址函數是由固定讀址函數reading address(i)與動態讀址函數D(j)所構成,並且固定讀址函數與水平迴圈參數(亦即i)相關,而動態讀址函數與垂直迴圈參數(亦即j)相關,故在此步驟中,會先初始化動態讀址函數為N,亦即D(0)=N。再者,固定讀址函數與下一個固定讀址函數之水平迴圈參數之差值為一,並且動態讀址函數與下一個動態讀址函數之垂直迴圈參數之差值為一,以根據每一水平區塊之順序來獲得畫素單元之座標位置。值得一提的是,下一個動態讀址函數為根據動態讀址函數與矩陣之大小(亦即B)來進行一整數運算,並且下一個動態讀址函數根據動態讀址函數、矩陣之大小(亦即B)與垂直區塊之數目(亦即N)來進行一餘數運算,亦即D(j+1)=div(D(j),B)+mod(D(j),B)×N,據此來計算影像100之各個畫素單元之座標位置以讀取其位址來循序地寫入至記憶體EVM以達成行轉換之工作。 In step S404, since the address function of the present embodiment is composed of a fixed address function reading address (i) and a dynamic address function D(j), and a fixed address function and a horizontal loop parameter (ie, i) Correlation, and the dynamic addressing function is related to the vertical loop parameter (ie, j), so in this step, the dynamic address function is initialized to N, that is, D(0)=N. Furthermore, the difference between the horizontal address parameter of the fixed address function and the next fixed address function is one, and the difference between the vertical address parameter of the dynamic address function and the next dynamic address function is one, according to The order of each horizontal block is to obtain the coordinate position of the pixel unit. It is worth mentioning that the next dynamic address function is an integer operation based on the size of the dynamic address function and the matrix (ie, B), and the next dynamic address function is based on the dynamic address function and the size of the matrix ( That is, B) performs a remainder operation with the number of vertical blocks (ie, N), that is, D(j+1)=div(D(j), B)+mod(D(j), B)× N, according to which the coordinate position of each pixel unit of the image 100 is calculated to read its address to sequentially write to the memory EVM to achieve the line conversion work.

在步驟S406中,本揭露內容之雙迴圈演算法會開始進入到第一迴圈運算,由於影像100之高度已被座標化為多個水平區塊HB_0~HB_M-1(亦即垂直迴圈參數為0~M-1),所以行與區塊之整合轉換方法會透過垂直迴圈參數來判斷是否超出垂直區塊範圍,並且垂直迴圈參數在此第一迴圈運算中會從0逐漸遞增到M-1。據此, 透過第一迴圈運算之決策判斷以根據水平區塊HB_0~HB_M-1之順序依序地將影像100中各畫素單元位址寫入至記憶體EVM。此外,如果垂直迴圈參數尚未超出垂直區塊的範圍,則進入到步驟S408;如果垂直迴圈參數超出垂直區塊的範圍,則結束雙迴圈演算法。 In step S406, the double loop algorithm of the present disclosure begins to enter the first loop operation, since the height of the image 100 has been coordinated into a plurality of horizontal blocks HB_0~HB_M-1 (ie, vertical loops) The parameter is 0~M-1), so the integrated conversion method of row and block will judge whether the vertical block range is exceeded by the vertical loop parameter, and the vertical loop parameter will gradually gradually decrease from 0 in this first loop operation. Increase to M-1. According to this, Through the decision of the first loop calculation, the pixel unit addresses in the image 100 are sequentially written to the memory EVM according to the order of the horizontal blocks HB_0~HB_M-1. Furthermore, if the vertical loop parameter has not exceeded the range of the vertical block, then go to step S408; if the vertical loop parameter exceeds the range of the vertical block, the double loop algorithm ends.

在步驟S408中,在進入第一迴圈運算之初,則會先將水平迴圈參數初始化為零,亦即i=0。由於多個水平區塊之每一個HB_0~HB_M-1都具有相同數目之畫素單元(亦即B×N個畫素單元),並且都會被座標化為0~(B×N)-1,如圖2A與圖2B所示。因此當垂直迴圈參數進行到每一個水平區塊之初時,水平迴圈參數都要被初始化為零。 In step S408, at the beginning of the first loop operation, the horizontal loop parameter is first initialized to zero, that is, i=0. Since each of the plurality of horizontal blocks HB_0~HB_M-1 has the same number of pixel units (ie, B×N pixel units), and will be coordinated to 0~(B×N)-1, 2A and 2B. Therefore, when the vertical loop parameter proceeds to the beginning of each horizontal block, the horizontal loop parameter is initialized to zero.

在步驟S410中,如同步驟S408所述,同樣地,固定讀址函數也需要被初始化,亦即reading address(0)=0,以便在第二迴圈運算時能夠重新讀取水平區塊中每一行之畫素單元之座標(從0~(B×N)-1)。 In step S410, as described in step S408, similarly, the fixed address function also needs to be initialized, that is, reading address (0) = 0, so that each time in the horizontal block can be re-read during the second loop operation. The coordinates of a pixel unit of one line (from 0 to (B × N) -1).

在步驟S412中,本揭露內容之雙迴圈演算法開始進入到第二迴圈運算,在此,行與區塊之整合轉換方法已經透過垂直迴圈參數來鎖定水平區塊HB_0~HB_M-1的其中之一(例如水平區塊HB_1),並且每一水平區塊(具有B×N個畫素單元)會被座標化為0~(B×N)-1,如圖2A與圖2B所示。因此,本揭露內容會經由一決策機制來進行判斷,亦即透過水平迴圈參數來判斷是否超出水平區塊之範圍(0~B×N-1),水平迴圈參數在此第二迴圈運算中會從0逐漸遞增到B×N-1以完整地掃描過全部的畫素單元。如果水平迴圈參數尚未超出水平區塊之範圍,則進入到步驟S414;如果水平迴圈參數超出水平區塊之範圍,則進入到步驟S424。 In step S412, the double loop algorithm of the present disclosure begins to enter the second loop operation, where the row and block integrated conversion method has locked the horizontal block HB_0~HB_M-1 through the vertical loop parameter. One of them (for example, horizontal block HB_1), and each horizontal block (with B × N pixel units) will be coordinated to 0~(B×N)-1, as shown in Fig. 2A and Fig. 2B. Show. Therefore, the content of the disclosure is judged by a decision mechanism, that is, whether the horizontal block is beyond the range of the horizontal block (0~B×N-1), and the horizontal loop parameter is in the second loop. In the operation, it will gradually increase from 0 to B×N-1 to completely scan all the pixel units. If the horizontal loop parameter has not exceeded the range of the horizontal block, it proceeds to step S414; if the horizontal loop parameter exceeds the range of the horizontal block, it proceeds to step S424.

在步驟S414中,在此已經開始執行第二迴圈運算之本體部分,如果水平迴圈參數尚未超出水平區塊之範圍((0~(B×N)-1),則本揭露內容會透過固定讀址函數與動態讀址函數來獲得畫素單 元位址,亦即透過整數運算與餘數運算來獲得每一畫素單元之座標以讀取畫素單元位址,請同時參見核心程式碼內的C=reading address(i)+D(j)以更瞭解本揭露內容。之後,進入另一決策判斷,亦即步驟S416。 In step S414, the body portion of the second loop operation has been started here. If the horizontal loop parameter has not exceeded the range of the horizontal block ((0~(B×N)-1), the disclosure content will pass through Fixed address function and dynamic address function to obtain pixel list The meta-address, that is, the integer operation and the remainder operation to obtain the coordinates of each pixel unit to read the pixel unit address, please also refer to C=reading address(i)+D(j) in the core code. To better understand the contents of this disclosure. Thereafter, another decision decision is made, that is, step S416.

在步驟S416中,進入一決策機制來判斷,如果在步驟S414所獲取之畫素單元位址尚未超出水平區塊之範圍,則進入到步驟S418;如果在步驟S414所獲取之畫素單元位址超出水平區塊之範圍,則進入到步驟S420。 In step S416, a decision mechanism is entered to determine that if the pixel unit address acquired in step S414 has not exceeded the range of the horizontal block, the process proceeds to step S418; if the pixel unit address obtained in step S414 is obtained If the range of the horizontal block is exceeded, the process proceeds to step S420.

在步驟S418中,在決策機制之判斷後進入到此步驟則表示畫素單元位址尚未超出水平區塊之範圍,則本揭露內容會將畫素單元位址儲存至下一個固定讀址函數,如核心程式碼內的reading address(i+1)=C,以進行後續之連續運算。 In step S418, after entering the step after the judgment of the decision mechanism, it indicates that the pixel unit address has not exceeded the range of the horizontal block, and the disclosure content stores the pixel unit address to the next fixed address function. For example, the reading address (i+1)=C in the core code is used for subsequent continuous operations.

在步驟S420中,在決策機制之判斷後進入到此步驟則表示畫素單元位址超出水平區塊之範圍,則將畫素單元位址減去水平區塊之範圍之最大值(0~(B×N)-1,亦即B×N個畫素單元)後儲存至下一個固定讀址函數,如核心程式碼內的reading address(i+1)=C。之後,進入到步驟S422。 In step S420, after the judgment of the decision mechanism, the step of entering the step indicates that the pixel unit address is beyond the range of the horizontal block, and the pixel unit address is subtracted from the maximum value of the horizontal block (0~( B×N)-1, that is, B×N pixel units) are stored to the next fixed address function, such as reading address(i+1)=C in the core code. Thereafter, the process proceeds to step S422.

在步驟S422中,在第二迴圈運算之最後,水平迴圈參數會加一(亦即i=i+1)並且回到步驟S412以判斷水平迴圈參數是否超出水平區塊之範圍之步驟,以逐漸將水平區塊中每一矩陣(大小為B×B)進行轉換。 In step S422, at the end of the second loop operation, the horizontal loop parameter is incremented by one (i.e., i = i + 1) and the process returns to step S412 to determine whether the horizontal loop parameter exceeds the range of the horizontal block. To gradually convert each matrix (size B×B) in the horizontal block.

在步驟S424中,如果水平迴圈參數超出水平區塊之範圍(0~B×N-1),亦即水平迴圈參數等於或大於(B×N)-1,則會結束第二迴圈運算並且跳回至第一迴圈運算之本體以執行下一個動態讀址函數之運算。進一步來說,下一個動態讀址函數根據該動態讀址函數與該矩陣之大小來進行一整數運算,並且該下一個動態讀址函數根據該動態讀址函數、該矩陣之大小與該垂直區塊之數目來進行一餘數運算,亦即核心程式碼內的 D(j+1)=div(D(j),B)+mod(D(j),B)×N。 In step S424, if the horizontal loop parameter exceeds the range of the horizontal block (0~B×N-1), that is, the horizontal loop parameter is equal to or greater than (B×N)-1, the second loop is ended. The operation and jump back to the body of the first loop operation to perform the operation of the next dynamic address function. Further, the next dynamic addressing function performs an integer operation according to the dynamic addressing function and the size of the matrix, and the next dynamic addressing function is based on the dynamic addressing function, the size of the matrix, and the vertical region. The number of blocks to perform a remainder operation, that is, within the core code D(j+1)=div(D(j), B)+mod(D(j), B)×N.

在步驟S426中,在第一迴圈運算之最後,垂直迴圈參數會加一(亦即j=j+1)並且回到步驟S406以判斷垂直迴圈參數是否超出垂直區塊之範圍之步驟,藉此逐漸地將影像100中的每一水平區塊進行轉換。如果垂直迴圈參數超出垂直區塊的範圍(0~M-1),則結束雙迴圈演算法。 In step S426, at the end of the first loop operation, the vertical loop parameter is incremented by one (i.e., j = j + 1) and the process returns to step S406 to determine whether the vertical loop parameter exceeds the range of the vertical block. Thereby, each horizontal block in the image 100 is gradually converted. If the vertical loop parameter exceeds the range of the vertical block (0~M-1), the double loop algorithm ends.

本揭露內容更提供一種電腦可讀取儲存媒體,用以儲存一電腦程式,上述電腦程式包括複數程式碼,其用以載入至一電子裝置並且使得該電子裝置執行一種上述圖1~圖4所揭露的行與區塊之整合轉換方法,關於行與區塊之整合轉換方法已於上述實施例詳細說明,在此不再贅述。 The present disclosure further provides a computer readable storage medium for storing a computer program, the computer program comprising a plurality of code codes for loading into an electronic device and causing the electronic device to perform the above-mentioned FIG. 1 to FIG. 4 The integrated conversion method of the line and the block disclosed in the above embodiment is described in detail in the above embodiments, and details are not described herein again.

〔實施例的可能功效〕 [Possible effects of the examples]

綜上所述,本發明實施例所提出之行與區塊之整合轉換方法與電腦可讀取儲存媒體,透過行轉換方式將影像之第一畫素單元與第X畫素單元寫入記憶體,並且透過區塊轉換方式來讀取儲存於記憶體之第一畫素單元與第X畫素單元,據此以提升記憶體之使用率,並且大幅降低數位電路之實施成本。 In summary, the method for converting the line and the block proposed by the embodiment of the present invention and the computer readable storage medium, the first pixel unit and the X pixel unit of the image are written into the memory by line conversion. And reading the first pixel unit and the X pixel unit stored in the memory through the block conversion method, thereby increasing the usage rate of the memory and greatly reducing the implementation cost of the digital circuit.

以上所述僅為本發明之實施例,其並非用以侷限本發明之專利範圍。 The above description is only an embodiment of the present invention, and is not intended to limit the scope of the invention.

S402、S404、S406、S408、S410、S412、S414、S416、S418、S420、S422、S424、S426‧‧‧步驟 S402, S404, S406, S408, S410, S412, S414, S416, S418, S420, S422, S424, S426‧‧ steps

Claims (8)

一種行與區塊之整合轉換方法,用於一影像,該行與區塊之整合轉換方法包括以下步驟:將該影像分割為M個水平區塊與N個垂直區塊;依序地將該些水平區塊中的一第一水平區塊之多個第一畫素單元之位址根據一記憶體之累加位址之順序寫入該記憶體;從該記憶體中每間隔一畫素預定距離來循環地讀取該些第一畫素單元之位址,其中該畫素預定距離為該影像之寬度;透過一雙迴圈演算法來獲得多個第X-1畫素單元之位置以循序地讀取一第X-1水平區塊之多個第X-1畫素單元之位址;以及當每間隔該畫素預定距離來循環地讀取該記憶體之該些第X-1畫素單元之位址時,將該些水平區塊中的一第X水平區塊之多個第X畫素單元之位址循環地每間隔該畫素預定距離隨後地寫入該記憶體;其中X-1為位於2與M之間的正整數,其中該些水平區塊與該些垂直區塊形成一M×N矩陣,其中該矩陣之每一元素係大小為B×B之矩陣,並且第一畫素單元與該些第X畫素單元包括B個畫素,其中B、M與N為正整數並且N為該影像之寬度除以B;其中該雙迴圈演算法包括以下步驟:透過一垂直迴圈參數來判斷是否超出該垂直區塊之範圍;若該垂直迴圈參數尚未超出該垂直區塊的範圍,則初始化一水平迴圈參數與一固定讀址函數,而若如果該垂直迴圈參數超出該垂直區塊的範圍,則結束該雙迴圈演算法; 透過該水平迴圈參數來判斷是否超出該水平區塊之範圍;如果該水平迴圈參數尚未超出該水平區塊之範圍,則透過該固定讀址函數與一動態讀址函數來獲得一畫素單元位址,並且進入一決策判斷;透過該決策判斷,如果該畫素單元位址尚未超出該水平區塊之範圍,則將該畫素單元位址儲存至下一個固定讀址函數;透過該決策判斷,如果該畫素單元位址超出該水平區塊之範圍,則將該畫素單元位址減去該水平區塊之範圍之最大值後儲存至下一個固定讀址函數;將該水平迴圈參數加一,並且回到判斷該水平迴圈參數是否超出該水平區塊之範圍之步驟;如果該水平迴圈參數超出該水平區塊之範圍,則執行下一個動態讀址函數;以及將該水平迴圈參數加一,並且回到判斷該水平迴圈參數是否超出該垂直區塊之範圍之步驟;其中該固定讀址函數與該下一個固定讀址函數之該水平迴圈參數之差值為一,並且該動態讀址函數與該下一個動態讀址函數之該垂直迴圈參數之差值為一,且其中該下一個動態讀址函數根據該動態讀址函數與該矩陣之大小來進行一整數運算,並且該下一個動態讀址函數根據該動態讀址函數、該矩陣之大小與該垂直區塊之數目來進行一餘數運算。 A row and block integration conversion method for an image, the row and block integration conversion method comprises the steps of: dividing the image into M horizontal blocks and N vertical blocks; sequentially The addresses of the plurality of first pixel units of a first horizontal block in the horizontal blocks are written into the memory according to the sequence of accumulated addresses of a memory; a pixel is reserved for each pixel from the memory. The distance is cyclically read the addresses of the first pixel units, wherein the predetermined distance of the pixels is the width of the image; and a position of the plurality of X-1 pixel units is obtained by a double loop algorithm Sequentially reading the addresses of the plurality of X-1 pixel units of the X-1 horizontal block; and cyclically reading the X-1 of the memory every predetermined interval of the pixels When the address of the pixel unit is located, the addresses of the plurality of Xth pixel units of the Xth horizontal block in the horizontal blocks are cyclically written to the memory at intervals of the predetermined distance of the pixel; Where X-1 is a positive integer between 2 and M, wherein the horizontal blocks form an M×N matrix with the vertical blocks , wherein each element of the matrix is a matrix of B×B, and the first pixel unit and the Xth pixel unit include B pixels, wherein B, M and N are positive integers and N is the The width of the image is divided by B; wherein the double loop algorithm includes the following steps: determining whether the vertical block is beyond a range by using a vertical loop parameter; if the vertical loop parameter has not exceeded the range of the vertical block, Terminating a horizontal loop parameter and a fixed address function, and if the vertical loop parameter exceeds the range of the vertical block, ending the double loop algorithm; The horizontal loop parameter is used to determine whether the range of the horizontal block is exceeded; if the horizontal loop parameter has not exceeded the range of the horizontal block, a pixel is obtained through the fixed address function and a dynamic address function. Unit address, and enter a decision judgment; through the decision, if the pixel unit address has not exceeded the range of the horizontal block, the pixel unit address is stored to the next fixed address function; Decision making, if the pixel unit address exceeds the range of the horizontal block, the pixel unit address is subtracted from the maximum value of the horizontal block and stored in the next fixed address function; The loop parameter is incremented by one, and returns to the step of determining whether the horizontal loop parameter exceeds the range of the horizontal block; if the horizontal loop parameter exceeds the range of the horizontal block, executing the next dynamic address function; Adding the horizontal loop parameter to one, and returning to the step of determining whether the horizontal loop parameter exceeds the range of the vertical block; wherein the fixed address function and the next solid The difference between the horizontal loop parameters of the address function is one, and the difference between the dynamic address function and the vertical loop parameter of the next dynamic address function is one, and wherein the next dynamic address function An integer operation is performed according to the dynamic address function and the size of the matrix, and the next dynamic address function performs a remainder operation according to the dynamic address function, the size of the matrix, and the number of the vertical blocks. 如請求項1所述之行與區塊之整合轉換方法,其中該些第一畫素單元為沿著該些水平區塊之該第一水平區塊之水平方向循序地被定義,並且該些第X畫素單元為沿著該些水平區塊之該第X水平區塊之水平方向循序地被定義,其中透過行轉換方式 將該影像之該第一畫素單元與該第X畫素單元寫入該記憶體,並且透過區塊轉換方式來讀取儲存於該記憶體之該第一畫素單元與該第X畫素單元。 The method for converting a row and a block according to claim 1, wherein the first pixel units are sequentially defined along a horizontal direction of the first horizontal block of the horizontal blocks, and the The X-th pixel unit is sequentially defined along a horizontal direction of the X-th horizontal block of the horizontal blocks, wherein the line conversion mode is adopted Writing the first pixel unit and the X pixel unit of the image into the memory, and reading the first pixel unit and the X pixel stored in the memory by using a block conversion manner unit. 如請求項1所述之行與區塊之整合轉換方法,其中在進入該雙迴圈演算法之前,包括以下步驟:初始化該垂直迴圈參數;以及初始化該動態讀址函數。 The method for converting a row and a block according to claim 1, wherein before entering the double loop algorithm, the method comprises the steps of: initializing the vertical loop parameter; and initializing the dynamic address function. 如請求項1所述之行與區塊之整合轉換方法,其中從該記憶體中每間隔一畫素預定距離來循環地讀取該些第一畫素單元之位址之順序等於將該些水平區塊中的一第二水平區塊之多個第二畫素單元之位址寫入該記憶體之順序。 The method for converting a row and a block according to claim 1, wherein the order of cyclically reading the addresses of the first pixel units from a predetermined distance of one pixel in the memory is equal to the The order in which the addresses of the plurality of second pixel units of a second horizontal block in the horizontal block are written into the memory. 如請求項1所述之行與區塊之整合轉換方法,其中該記憶體之位元組數目等於B與該影像之寬度之乘積,並且讀取位址速度大於或等於寫入位址速度。 The method for converting a row and a block according to claim 1, wherein the number of bytes of the memory is equal to a product of B and a width of the image, and the read address speed is greater than or equal to a write address speed. 如請求項1所述之行與區塊之整合轉換方法,其中從該記憶體讀取該些第X畫素單元之位址之順序等於將該些第X+1畫素單元之位址寫入該記憶體之順序。 The method for converting a row and a block according to claim 1, wherein the order of reading the addresses of the X-th pixel units from the memory is equal to writing the addresses of the X+1 pixel units The order in which the memory is entered. 一種電腦可讀取儲存媒體,用以儲存一電腦程式,上述電腦程式包括複數程式碼,其用以載入至一電子裝置並且使得該電子裝置執行用於一影像之一種行與區塊之整合轉換方法,該行與區塊之整合轉換方法包括以下步驟:將該影像分割為M個水平區塊與N個垂直區塊;依序地將該些水平區塊中的一第一水平區塊之多個第一畫素單元之位址根據一記憶體之累加位址之順序寫入該記憶體;從該記憶體中每間隔一畫素預定距離來循環地讀取該些第一畫素單元之位址,其中該畫素預定距離為該影像之寬度;透過一雙迴圈演算法來獲得多個第X-1畫素單元之位置以循序 地讀取一第X-1水平區塊之多個第X-1畫素單元之位址;以及當每間隔該畫素預定距離來循環地讀取該記憶體之該些第X-1畫素單元之位址時,將該些水平區塊中的一第X水平區塊之多個第X畫素單元之位址循環地每間隔該畫素預定距離隨後地寫入該記憶體;其中X-1為位於2與M之間的正整數,其中該些水平區塊與該些垂直區塊形成一M×N矩陣,其中該矩陣之每一元素係大小為B×B之矩陣,並且第一畫素單元與該些第X畫素單元包括B個畫素,其中B、M與N為正整數並且N為該影像之寬度除以B;其中該雙迴圈演算法包括以下步驟:透過一垂直迴圈參數來判斷是否超出該垂直區塊之範圍;若該垂直迴圈參數尚未超出該垂直區塊的範圍,則初始化一水平迴圈參數與一固定讀址函數,而若如果該垂直迴圈參數超出該垂直區塊的範圍,則結束該雙迴圈演算法;透過該水平迴圈參數來判斷是否超出該水平區塊之範圍;如果該水平迴圈參數尚未超出該水平區塊之範圍,則透過該固定讀址函數與一動態讀址函數來獲得一畫素單元位址,並且進入一決策判斷;透過該決策判斷,如果該畫素單元位址尚未超出該水平區塊之範圍,則將該畫素單元位址儲存至下一個固定讀址函數;透過該決策判斷,如果該畫素單元位址超出該水平區塊之範圍,則將該畫素單元位址減去該水平區塊之範圍之 最大值後儲存至下一個固定讀址函數;將該水平迴圈參數加一,並且回到判斷該水平迴圈參數是否超出該水平區塊之範圍之步驟;如果該水平迴圈參數超出該水平區塊之範圍,則執行下一個動態讀址函數;以及將該水平迴圈參數加一,並且回到判斷該水平迴圈參數是否超出該垂直區塊之範圍之步驟;其中該固定讀址函數與該下一個固定讀址函數之該水平迴圈參數之差值為一,並且該動態讀址函數與該下一個動態讀址函數之該垂直迴圈參數之差值為一,且其中該下一個動態讀址函數根據該動態讀址函數與該矩陣之大小來進行一整數運算,並且該下一個動態讀址函數根據該動態讀址函數、該矩陣之大小與該垂直區塊之數目來進行一餘數運算。 A computer readable storage medium for storing a computer program, the computer program comprising a plurality of code for loading into an electronic device and causing the electronic device to perform integration of a line and a block for an image The conversion method, the row and block integration conversion method comprises the steps of: dividing the image into M horizontal blocks and N vertical blocks; sequentially ordering a first horizontal block in the horizontal blocks The addresses of the plurality of first pixel units are written into the memory according to the order of the accumulated addresses of the memory; the first pixels are cyclically read from the memory by a predetermined distance of one pixel. The address of the unit, wherein the predetermined distance of the pixel is the width of the image; and the position of the plurality of X-1 pixel units is obtained by a double loop algorithm to sequentially Reading an address of a plurality of X-1 pixel units of an X-1 horizontal block; and cyclically reading the X-1 pictures of the memory every predetermined interval of the pixel When the address of the prime unit is located, the addresses of the plurality of Xth pixel units of an Xth horizontal block in the horizontal blocks are cyclically written to the memory at a predetermined distance from the pixel; wherein X-1 is a positive integer between 2 and M, wherein the horizontal blocks form an M×N matrix with the vertical blocks, wherein each element of the matrix is a matrix of B×B, and The first pixel unit and the X pixel units include B pixels, wherein B, M and N are positive integers and N is the width of the image divided by B; wherein the double loop algorithm comprises the following steps: Determining whether the range of the vertical block is exceeded by a vertical loop parameter; if the vertical loop parameter has not exceeded the range of the vertical block, initializing a horizontal loop parameter and a fixed address function, and if If the vertical loop parameter exceeds the range of the vertical block, the double loop algorithm ends; through the horizontal loop Counting whether the range of the horizontal block is exceeded; if the horizontal loop parameter has not exceeded the range of the horizontal block, obtaining a pixel unit address by using the fixed address function and a dynamic address function, and Entering a decision judgment; determining, by the decision, that if the pixel unit address has not exceeded the range of the horizontal block, storing the pixel unit address to the next fixed address function; If the pixel unit address is outside the range of the horizontal block, the pixel unit address is subtracted from the horizontal block. The maximum value is stored to the next fixed reading function; the horizontal loop parameter is incremented by one, and the step of determining whether the horizontal loop parameter exceeds the range of the horizontal block is returned; if the horizontal loop parameter exceeds the level The range of the block, the next dynamic addressing function is executed; and the horizontal loop parameter is incremented by one, and back to the step of determining whether the horizontal loop parameter exceeds the range of the vertical block; wherein the fixed address function The difference from the horizontal loop parameter of the next fixed address function is one, and the difference between the dynamic address function and the vertical loop parameter of the next dynamic address function is one, and wherein the lower A dynamic addressing function performs an integer operation according to the dynamic addressing function and the size of the matrix, and the next dynamic addressing function performs according to the dynamic addressing function, the size of the matrix, and the number of the vertical blocks. A remainder operation. 如請求項7所述之電腦可讀取儲存媒體,其中該記憶體之位元組數目等於B與該影像之寬度之乘積,並且讀取位址速度大於或等於寫入位址速度。 The computer readable storage medium as claimed in claim 7, wherein the number of bytes of the memory is equal to a product of B and a width of the image, and the read address speed is greater than or equal to the write address speed.
TW102143912A 2013-11-29 2013-11-29 Line and block integrated transform method and computer-readable storage medium thereof TWI580252B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
TW102143912A TWI580252B (en) 2013-11-29 2013-11-29 Line and block integrated transform method and computer-readable storage medium thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
TW102143912A TWI580252B (en) 2013-11-29 2013-11-29 Line and block integrated transform method and computer-readable storage medium thereof

Publications (2)

Publication Number Publication Date
TW201521008A TW201521008A (en) 2015-06-01
TWI580252B true TWI580252B (en) 2017-04-21

Family

ID=53935099

Family Applications (1)

Application Number Title Priority Date Filing Date
TW102143912A TWI580252B (en) 2013-11-29 2013-11-29 Line and block integrated transform method and computer-readable storage medium thereof

Country Status (1)

Country Link
TW (1) TWI580252B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6924809B2 (en) * 2003-10-02 2005-08-02 Pixart Imaging Inc. Method and buffer device for data stream transformation
US20060104543A1 (en) * 2004-11-12 2006-05-18 Dialog Semiconductor Gmbh Size optimized pixel line to pixel block conversion algorithm

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6924809B2 (en) * 2003-10-02 2005-08-02 Pixart Imaging Inc. Method and buffer device for data stream transformation
US20060104543A1 (en) * 2004-11-12 2006-05-18 Dialog Semiconductor Gmbh Size optimized pixel line to pixel block conversion algorithm

Also Published As

Publication number Publication date
TW201521008A (en) 2015-06-01

Similar Documents

Publication Publication Date Title
KR20190027716A (en) Hardware friendly virtual frame buffer
KR102287773B1 (en) Panoramic video compression method and device
US9942510B2 (en) Method and device for processing input image data
US8130234B2 (en) Computer graphics rendering apparatus and method
CN110958362A (en) Image correction system and method based on block table look-up
CN112017228A (en) Method for three-dimensional reconstruction of object and related equipment
JP2019160063A (en) Image processing device and image processing method
JP2009533772A (en) Technology that easily uses small line buffers to process small or large images
CN104618717B (en) The integration conversion method and its computer read/write memory medium of row and block
TW202209888A (en) Image compression method
US20090295817A1 (en) Method for reading and writing image data in memory
US6160850A (en) Motion estimator employing a three-step hierachical search block-matching algorithm
TWI580252B (en) Line and block integrated transform method and computer-readable storage medium thereof
US8644380B2 (en) Integer pixel motion estimation system, motion estimation system for quarter-pixel luminance, motion estimation system for quarter-pixel chrominance, motion estimation system for combined luminance, motion estimation system for combined luminance and chrominance, and motion estimation system for quarter-pixel luminance and chrominance
JP2012004710A (en) Motion vector detection circuit, moving image encoding apparatus, and motion vector detection method
WO2020107319A1 (en) Image processing method and device, and video processor
CN103093485B (en) Full view video cylindrical surface image storage method and system
US7864864B2 (en) Context buffer address determination using a plurality of modular indexes
GB2539197A (en) Complementary vectors
US20080049035A1 (en) Apparatus and method for accessing image data
US20130127887A1 (en) Method for storing interpolation data
CN110738615B (en) Fisheye image correction method, device, system and storage medium
JP5845202B2 (en) Image compression apparatus and image processing system
US8634669B2 (en) Fast implementation of context selection of significance map
US20040213465A1 (en) Multi-level encoding/decoding apparatus