[go: up one dir, main page]

CN1612111A - Data stream conversion method and buffer device - Google Patents

Data stream conversion method and buffer device Download PDF

Info

Publication number
CN1612111A
CN1612111A CN 200310103402 CN200310103402A CN1612111A CN 1612111 A CN1612111 A CN 1612111A CN 200310103402 CN200310103402 CN 200310103402 CN 200310103402 A CN200310103402 A CN 200310103402A CN 1612111 A CN1612111 A CN 1612111A
Authority
CN
China
Prior art keywords
mark position
order
block
read
writes
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN 200310103402
Other languages
Chinese (zh)
Other versions
CN1291324C (en
Inventor
赵子毅
吕志宏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Pixart Imaging Inc
Original Assignee
Pixart Imaging Inc
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 Pixart Imaging Inc filed Critical Pixart Imaging Inc
Priority to CN 200310103402 priority Critical patent/CN1291324C/en
Publication of CN1612111A publication Critical patent/CN1612111A/en
Application granted granted Critical
Publication of CN1291324C publication Critical patent/CN1291324C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Image Input (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

The invention discloses a data stream conversion method, marking the mark position written corresponding to a plurality of blocks with the same size in sequence by a buffer memory, then writing an input data stream into each block in sequence according to each written mark position, then calculating the read mark position and the corresponding output sequence of the block to be read according to each written mark position and the corresponding writing sequence, finally reading data from the block corresponding to each mark position in sequence according to the output sequence to output an output data stream, therefore, the conversion between the input data stream (mainly by lines/mainly by image blocks) and the output data stream (mainly by image blocks/mainly by lines) can be carried out by a small amount of buffer memory space.

Description

资料流转换方法及其缓冲装置Data stream conversion method and buffer device

技术领域technical field

本发明涉及一种资料流转换方法,特别是涉及一种能将以线为主(line-based)的资料流转换为以像块为主(block-based)的资料流,以利于后续的压缩处理,或者将以像块为主的资料流转换为以线为主的资料流,以利后续解压缩处理的资料流转换方法。The present invention relates to a data stream conversion method, in particular to a method capable of converting a line-based data stream into a block-based data stream for subsequent compression processing, or converting the block-based data stream into a line-based data stream for subsequent decompression processing.

背景技术Background technique

JPEG与MPEG分别是静态影像压缩及动态影像压缩的国际标准,以MPEG为例,如图1所示,其资料结构皆是由一个或至少一个以上的序列(sequence)所构成,而在每个序列中则包含了复数个图像群组(picture of group,GOP)。JPEG and MPEG are international standards for static image compression and dynamic image compression respectively. Taking MPEG as an example, as shown in Figure 1, its data structure is composed of one or at least one sequence (sequence), and in each The sequence contains a plurality of picture groups (picture of group, GOP).

每个画面又可细分为数个像条(slice),像条中又可再分为数个巨集像块(MacroBlock,MB)。而巨集像块可由四个亮度(Luminance)像块及数个彩度(Chrominance)像块所组成,最后,每一像块(block)具有8×8位元组,并定义为MPEG的资料结构中一最小编码单位。Each picture can be subdivided into several slices, and the slice can be further divided into several macro blocks (MacroBlock, MB). The macro block can be composed of four Luminance blocks and several Chrominance blocks. Finally, each block has 8×8 bytes and is defined as MPEG data. A smallest coding unit in a structure.

参阅图2,将一原始的影像资料以MPEG-1或MPEG-2格式进行压缩时,是先进行资料流的转换,以便将输入的资料流转变为以像块为主的资料流输出,如步骤201。接着如步骤202,对每一像块的像素资料施以离散余弦转换(DCT),即把像素资料由时域转换为频域,并去除掉人眼较不敏感的高频部分。如步骤203,再施以量化(quantization),使得许多经过离散余弦转换的DCT系数量化为零。Referring to Fig. 2, when an original image data is compressed with MPEG-1 or MPEG-2 format, the conversion of the data stream is carried out first, so that the input data stream is converted into a block-based data stream output, such as Step 201. Next, in step 202, discrete cosine transform (DCT) is applied to the pixel data of each block, that is, the pixel data is converted from the time domain to the frequency domain, and the high-frequency part which is less sensitive to human eyes is removed. In step 203, quantization is performed again, so that many DCT coefficients after DCT are quantized to zero.

步骤204,接着再以交错扫描(zig-zag scan)来将量化后的DCT系数重新排列,将低频系数排列在前而高频系数排列在后。最后在经交错扫描过后的DCT系数中,将DC系数进行差动信号调变编码(DPCM),并对AC系数进行动态长度编码(RLE),最后再对二者进行可变长度编码(VLC),即完成MPEG-1/MPEG-2格式的压缩,如步骤205所示。JPEG的压缩过程亦类似于上述的作法,而当解压缩时,则是采取上述的相反作法。In step 204, the quantized DCT coefficients are rearranged by zig-zag scan, so that the low-frequency coefficients are arranged in front and the high-frequency coefficients are arranged in the rear. Finally, among the DCT coefficients after interleaved scanning, the DC coefficients are subjected to differential signal modulation coding (DPCM), and the AC coefficients are subjected to dynamic length encoding (RLE), and finally the two are subjected to variable length encoding (VLC). , that is to complete the compression of the MPEG-1/MPEG-2 format, as shown in step 205. The compression process of JPEG is also similar to the above-mentioned practice, and when decompressing, the above-mentioned opposite method is adopted.

参阅图3,由于JPEG与MPEG皆是以像块作为其基本的处理单位,因此在上述步骤201中,为了能将以线为主(line-based)的资料流转换为以像块为主(block-based)的资料流输出,一般是以一缓冲记忆体7与一缓冲控制器(buffer controller)8来进行。Referring to Fig. 3, since both JPEG and MPEG take the image block as its basic processing unit, in the above step 201, in order to convert the line-based data stream into an image block-based ( The block-based data stream output is generally performed by a buffer memory 7 and a buffer controller (buffer controller) 8 .

当资料流受控制器8的控制而写入缓冲记忆体7时,会循序由左至右、由上至下逐条地写入缓冲记忆体7中,但是在取出资料时,由于必需以像块为基本单位,所以控制器8会以纵向取出资料(例如由左上角依次由上而下取出8次8个位元组输出,其输出资料流的内容即为第一个像块),由于此一特性,所以在缓冲记忆体7中的资料未完全填满前,无法取出资料,而若未将资料取出,则又无法写入资料。When the data stream is written into the buffer memory 7 under the control of the controller 8, it will be written in the buffer memory 7 one by one from left to right and from top to bottom. is the basic unit, so the controller 8 will take out the data vertically (for example, take out 8 bytes of output from the upper left corner sequentially from top to bottom, and the content of the output data stream is the first pixel), because of this One characteristic, so before the data in the buffer memory 7 is completely filled, the data cannot be taken out, and if the data is not taken out, the data cannot be written in again.

因此,一般会将缓冲记忆体7划分为两个部分,一个部分用作资料输入、另一个部分则用作资料输出。如图3所示,当上半部71资料填满后也就是以像块为单位进行资料输出,而下半部72则同时进行资料写入的动作。待上半部71资料输出完毕后又有空间可以进行资料写入的动作,此时下半部72因资料写入完毕,所以又可进行资料读取的动作。然而,虽然此法能增加资料的输入与输出速度,但是却需要大量的缓冲记忆体7空间才能进行。Therefore, the buffer memory 7 is generally divided into two parts, one part is used for data input, and the other part is used for data output. As shown in FIG. 3 , when the upper half 71 is filled with data, data output is performed in units of pixels, while the lower half 72 performs data writing at the same time. After the data output of the upper part 71 is completed, there is room for data writing. At this time, the lower part 72 can read data again because the data is written. However, although this method can increase the speed of data input and output, it requires a large amount of buffer memory 7 space to carry out.

发明内容Contents of the invention

本发明的目的在于提供一种可达到只需少量的缓冲记忆体空间,即可快速地进行资料流转换的方法及使用该方法的缓冲装置。The purpose of the present invention is to provide a method and a buffer device using the method that can quickly convert data streams with only a small amount of buffer memory space.

本发明的特征在于:本发明缓冲装置包括一缓冲记忆体、一标记记忆体,以及一缓冲控制器。The feature of the present invention is that the buffer device of the present invention includes a buffer memory, a tag memory, and a buffer controller.

该缓冲记忆体具有复数大小相等并供该输入资料流写入的区块,该等区块并依一写入次序被标记出复数写入标记位置。该标记记忆体是用来储存各该区块所对应的实体标记位置。该控制器是用以依据该写入次序及该等写入标记位置,计算出欲进行读取该等区块的一读取次序及一读取标记位置,以进一步由各该区块的实体标记位置读取出各该区块资料成为该输出资料流。The buffer memory has a plurality of blocks of the same size for the input data stream to write into, and the blocks are marked with a plurality of writing mark positions according to a write order. The tag memory is used to store the physical tag positions corresponding to each block. The controller is used to calculate a read order and a read mark position of the blocks to be read according to the write order and the write mark positions, so as to further determine the entity of each block The marked position reads out the data of each block to become the output data stream.

在一第一较佳实施例中,本发明依据上述架构,提供了一种资料流转换方法,是能将一以线为主的输入资料流转换为一以像块为主的输出资料流,该方法包括步骤:A)将一缓冲记忆体依序标记出对应于复数个大小相同的区块的写入标记位置。步骤B)依据各该写入标记位置,循序写入资料至各该区块中。步骤C)依据各该写入标记位置及相对应的写入次序,计算出欲读取区块的读取标记位置及相对应的输出次序。步骤D)依据该输出次序,依序自对应于各该标记位置的区块读取资料,以输出该输出资料流。In a first preferred embodiment, the present invention provides a data stream conversion method based on the above structure, which is capable of converting an input data stream mainly based on lines into an output data stream mainly based on blocks, The method includes the steps of: A) sequentially marking a buffer memory with write-in mark positions corresponding to a plurality of blocks with the same size. Step B) Write data into each block sequentially according to the position of each write mark. Step C) Calculate the read mark position and the corresponding output order of the block to be read according to the write mark position and the corresponding write order. Step D) According to the output order, sequentially read data from the blocks corresponding to the positions of the marks, so as to output the output data stream.

其中,于该步骤C)中,是依据下列关系式:Wherein, in the step C), it is based on the following relational expression:

                    On(t)=In((t%h)×w+t/h) On (t)=I n ((t%h)×w+t/h)

计算出该读取标记位置,O(t)是该读取次序为t时的读取标记位置,该I(t)是该写入次序为t时的写入标记位置,h是该像块的高度,w是该缓冲记忆体总宽度所具有的该等区块数目,「t%h」是t除以h后所得到的余数,「t/h」是t除以h后所得到的商。Calculate the read mark position, O(t) is the read mark position when the read order is t, the I(t) is the write mark position when the write order is t, and h is the image block height, w is the number of blocks in the total width of the buffer memory, "t%h" is the remainder obtained after dividing t by h, and "t/h" is obtained after dividing t by h business.

在一第二较佳实施例中,本发明也提供了一种能将一以像块为主的输入资料流转换为一以线为主的输出资料流,与该第一较佳实施例不同的是,于前述步骤C)中,是依据下列关系式:In a second preferred embodiment, the present invention also provides a method capable of converting a block-based input data stream into a line-based output data stream, unlike the first preferred embodiment What is, in aforesaid step C) in, be based on following relational expression:

                    On(t)=In((t%w)×h+t/w)O n (t) = I n ((t%w) × h+t/w)

计算出该读取标记位置,O(t)是该读取次序为t时的读取标记位置,该I(t)是该写入次序为t时的写入标记位置,h是该像块的高度,w是该缓冲记忆体总宽度所具有的该等区块数目,「t%w」是t除以w后所得的余数,「t/w」是t除以w后所得的商。Calculate the read mark position, O(t) is the read mark position when the read order is t, the I(t) is the write mark position when the write order is t, and h is the image block height, w is the number of blocks in the total width of the buffer memory, "t%w" is the remainder obtained after dividing t by w, and "t/w" is the quotient obtained after dividing t by w.

本发明的功效在于采取上述方法后,其相较于以往,只需增设一小容量的标记记忆体来储存各标记位置,即能以少量的缓冲记忆体空间,完成资料流的转换动作The effect of the present invention is that after adopting the above method, compared with the past, it only needs to add a small-capacity tag memory to store each tag position, and can complete the conversion action of the data stream with a small amount of buffer memory space

下面结合附图及实施例对本发明进行详细说明。The present invention will be described in detail below in conjunction with the accompanying drawings and embodiments.

附图说明Description of drawings

图1是一示意图,说明MPEG的资料结构。FIG. 1 is a schematic diagram illustrating the data structure of MPEG.

图2是一示意图,说明一般MPEG的压缩步骤。Fig. 2 is a schematic diagram illustrating the general MPEG compression steps.

图3是一示意图,说明以往一缓冲记忆体与一缓冲控制器。FIG. 3 is a schematic diagram illustrating a conventional buffer memory and a buffer controller.

图4是一示意图,说明本发明缓冲装置的一较佳实施例。Fig. 4 is a schematic diagram illustrating a preferred embodiment of the cushioning device of the present invention.

图5~图10是动作示意图,说明本发明将以线为主的输入资料流转换为以像块为主的输出资料流时,一缓冲记忆体的读取与写入动作。5 to 10 are schematic diagrams of operations, illustrating the reading and writing operations of a buffer memory when the present invention converts the line-based input data stream into a block-based output data stream.

图11~图15是动作示意图,说明本发明将以像块为主的输入资料流转换为以线为主的输出资料流时,该缓冲记忆体的读取与写入动作。11 to 15 are schematic diagrams of operations, illustrating the reading and writing operations of the buffer memory when the present invention converts the block-based input data stream into a line-based output data stream.

具体实施方式Detailed ways

实施例1Example 1

参阅图4、5,本发明缓冲装置100的第一较佳实施例是能将以线为主的输入资料流转换为以像块为主的输出资料流,该较佳实施例包括一缓冲记忆体1、一标记记忆体2,以及一缓冲控制器3。Referring to Fig. 4, 5, the first preferred embodiment of the buffer device 100 of the present invention can convert the input data stream based on lines into the output data stream based on blocks, and this preferred embodiment includes a buffer memory body 1, a tag memory 2, and a buffer controller 3.

缓冲记忆体1是供储存由控制器3所接收的输入资料流,本例中,是以一具有640×8位元组空间的缓冲记忆体1来作说明,换句话说,缓冲记忆体1一次可以储存一640×8大小的影像,惟不应以此作为本发明的限制。如图5所示,缓冲记忆体1能被逻辑地分割出复数个大小相同的区块,本例中,每一区块的大小皆是8×1位元组,因此总共区分为640个区块。The buffer memory 1 is used to store the input data stream received by the controller 3. In this example, a buffer memory 1 with a space of 640×8 bytes is used for illustration. In other words, the buffer memory 1 An image with a size of 640×8 can be stored at one time, but this should not be used as a limitation of the present invention. As shown in Figure 5, the buffer memory 1 can be logically divided into multiple blocks of the same size. In this example, the size of each block is 8×1 byte, so it is divided into 640 blocks in total. piece.

每一区块的起始位置(address)并被加以标记,以方便后续的写入与读取动作,为方便说明起见,下文中特别将每一区块的标记位置,依据写入与读取状态的不同,分别表示为写入标记位置I(t)与读取标记位置O(t),事实上,同一区块只有一实体的标记位置。其中,t是指写入次序或者输出次序,依序为0、1、2、3…639。The starting position (address) of each block is marked to facilitate subsequent writing and reading operations. For the convenience of explanation, the marking position of each block will be specially used in the following according to writing and reading The different states are respectively expressed as the writing mark position I(t) and the reading mark position O(t). In fact, there is only one physical mark position in the same block. Wherein, t refers to a writing sequence or an output sequence, which are 0, 1, 2, 3...639 in sequence.

本例中所欲取出的像块大小为一符合MPEG或JPEG规范的最小处理单位,所以为一8×8位元组的像块,因此本实施例中的每8个区块为一栏(column)恰构成一像块,并可由左至右共区分为80个像块。In this example, the image block size to be taken out is a minimum processing unit conforming to the MPEG or JPEG standard, so it is an 8*8 byte image block, so every 8 blocks in the present embodiment are a column ( column) just constitutes a block, and can be divided into 80 blocks from left to right.

特别是,上述写入标记位置I(t)与读取标记位置O(t)两者具有下列的特定关系式:In particular, the above-mentioned write mark position I(t) and read mark position O(t) both have the following specific relationship:

                     On(t)=In((t%h)×w+t/h)(1)On(t)=In((t%h)×w+t/h)(1)

其中,h是像块的高度,w是缓冲记忆体每一列所具有的区块数目,而「t%h」是指t除以h后所得的余数,「t/h」是指t除以h所得的商。利用式(1),可由写入标记位置及其写入次序,得知相对应的读取标记位置及其读取次序。Among them, h is the height of the image block, w is the number of blocks in each column of the buffer memory, and "t%h" refers to the remainder obtained after dividing t by h, and "t/h" refers to dividing t by The quotient obtained by h. Using formula (1), the corresponding position of the read mark and its read order can be obtained from the position of the write mark and its write order.

本例中,由于h=8、w=640/8=80,因此式(1)进一步成为:In this example, since h=8, w=640/8=80, so formula (1) further becomes:

                     On(t)=In((t%8)×80+t/8)(2)On(t)=In((t%8)×80+t/8)(2)

因此,第一个读取标记位置O(0)等于第一个写入标记位置I(0)【O(0)=I(0)】、第二个读取标记位置O(1)=I((1%8)×80+1/8)=I(80)、第三个读取标记位置O(2)=I((2%8)×80+1/8)=I(160)、O(3)=I(240)……,所以由式(2)知,依据O(0)、O(1)、O(2)…O(7)分别对应于I(0)、I(180)、I(160)…I(560)的顺序依序读取每个区块,就能够读取出第一个像块,而其余O(8)、O(9)…,则可再读取其余像块。Therefore, the first read mark position O(0) is equal to the first write mark position I(0) [O(0)=I(0)], the second read mark position O(1)=I ((1%8)×80+1/8)=I(80), the third read mark position O(2)=I((2%8)×80+1/8)=I(160) , O(3)=I(240)..., so from formula (2), according to O(0), O(1), O(2)...O(7) respectively correspond to I(0), I (180), I(160)...I(560) in order to read each block sequentially, the first image block can be read, and the rest O(8), O(9)... can be Then read the remaining blocks.

标记记忆体2是用来储存的各区块的标记位置,换句话说,由于本发明在同时进行读取与写入的动作,因此必需记录有I(0)~I(639)以及O(0)~O(639)各个读取与写入标记位置,所以标记记忆体2需要有2×210位元的空间大小。在标记记忆体2中,主要可以分为两组供储存标记的空间,第一组标记是用来供控制器3参照,以由特定的缓冲记忆体1地址进行第一次的写入与读取动作,第二组则是供控制器3以第一组为依据,计算出第二次写入与读取动作所指向的缓冲记忆体1地址,而待控制器3以第二组标记来进行第二次读取与写入时,第一组标记又可依据第二组标记被更新成第三次读取与写入时的标记地址,如此反复进行,即控制器3能一边参照标记记忆体2中的标记进行读取与写入,并一边进行下一次欲进行读取与写入地址的更新。The tag memory 2 is used to store the tag positions of each block. In other words, since the present invention is simultaneously reading and writing, it is necessary to record I(0)~I(639) and O(0 )~O(639) for each read and write mark position, so the mark memory 2 needs to have a space size of 2×2 10 bits. In the tag memory 2, it can be mainly divided into two groups of space for storing tags. The first group of tags is used for reference by the controller 3 to perform the first writing and reading from a specific buffer memory 1 address. The second group is for the controller 3 to calculate the address of the buffer memory 1 pointed to by the second write and read action based on the first group, and the controller 3 uses the second group of marks to When reading and writing for the second time, the first group of tags can be updated to the tag address of the third reading and writing according to the second group of tags, and this is repeated, that is, the controller 3 can refer to the tag address at the same time. The mark in the memory 2 is read and written, and at the same time, the address to be read and written next time is updated.

下文中为了便于说明,是将各标记直接标示于缓冲记忆体1中,事实上,标记只是储存在标记记忆体2中供控制器3作参照。In the following, for the convenience of explanation, the flags are directly marked in the buffer memory 1 . In fact, the flags are only stored in the flag memory 2 for reference by the controller 3 .

控制器3可以控制资料流,并参照于标记记忆体2中所储存的写入标记位置I(0)、I(1)…I(639),依序写入各区块,并在读取时会依据式(2)计算出所要的读取标记位置,再由标记记忆体2中撷取所要的读取标记位置,进一步执行读取的动作,以下分就写入与读取动作进行详细说明:The controller 3 can control the data flow, and write each block sequentially with reference to the write mark positions I(0), I(1)...I(639) stored in the mark memory 2, and when reading The desired reading mark position will be calculated according to formula (2), and then the desired reading mark position will be retrieved from the mark memory 2, and the reading operation will be further performed. The writing and reading operations will be described in detail below. :

(1)第一次写入(1) Write for the first time

参阅图5,控制器3是参照标记记忆体2中所储存的写入标记位置,使输入资料流循序由I1(0)、I1(1)、I1(2)…的顺序写入影像资料。Referring to Fig. 5, the controller 3 refers to the write mark position stored in the mark memory 2, so that the input data stream is sequentially written in the order of I 1 (0), I 1 (1), I 1 (2)... video material.

(2)第一次读取(2) Read for the first time

参阅图6,本发明并不需要等待缓冲记忆体1的所有空间已填满资料后才进行资料的读取。可以但是不限于,例如在最后一排写入标记位置为I1(560)~I1(639)的区块尚未写入资料时,就可以开始进行资料的读取,即一边进行输入资料的写入动作并一边进行输出资料流的输出动作。Referring to FIG. 6 , the present invention does not need to wait for all the space of the buffer memory 1 to be filled with data before reading data. It is possible but not limited to, for example, when the data is not yet written in the last row of blocks whose writing mark positions are I 1 (560)-I 1 (639), the reading of data can be started, that is, the data can be read while inputting data. Write operation while performing output operation of output data stream.

如前所述,读取的次序O1(0)、O1(1)…的各读取标记位置可以由控制器3经式(2)计算后所得,所以在控制器3参照标记记忆体2中所要的标记读取位置后,即由缓冲记忆体1中取出相对应的区块的资料O1(0)、O1(1)、O1(2)…【即对应为写入标记位置为I1(0)、I1(80)、I1(160)…的区块】。As mentioned above, the positions of the read marks in the read sequence O 1 (0), O 1 (1)... can be obtained by the controller 3 through formula (2), so the controller 3 refers to the mark memory After reading the position of the desired mark in 2, the data O 1 (0), O 1 (1), O 1 (2) of the corresponding block is taken out from the buffer memory 1 [corresponding to the write mark Blocks whose positions are I 1 (0), I 1 (80), I 1 (160)...].

此外,在读取的同时,也持续进行I1(560)~I1(639)区块的写入,因此循序由O1(0)读取至O1(8)时并不会产生间断。In addition, while reading, blocks I 1 (560) to I 1 (639) are also continuously written, so there will be no interruption when sequentially reading from O 1 (0) to O 1 (8) .

(3)第二次写入(3) Second write

在第一次写入动作已届I1(639)时,如图7所示,此时也有若干区块已经过第一次读取,所以持续而来的输入资料流能再持续进行写入的动作而不间断。由下列式(3):When the first write operation has reached I 1 (639), as shown in Figure 7, there are also some blocks that have been read for the first time, so the continuous input data stream can continue to write action without interruption. By the following formula (3):

                     In+1(t)=On(t)    (3)I n+1 (t) = On (t) (3)

知其第二次写入次序与第一次所读取的次序相同,换句话说,经读取后的第一个区块O1(0)等于第二次写入时的第一个区块位置I2(0),也就是将O1(0)、O1(1)…区块依次写入新的资料为I2(0)、I2(1)…,如图8所示。It is known that the second writing sequence is the same as the first reading sequence, in other words, the first block O 1 (0) after reading is equal to the first block O 1 (0) in the second writing The block position I 2 (0), that is, the O 1 (0), O 1 (1) ... blocks are sequentially written with new data as I 2 (0), I 2 (1) ..., as shown in Figure 8 .

(4)第二次读取(4) The second read

当第一次读取已届O1(639)区块时,如图9所示,即可以接续第二次读取【第二次写入尚在进行】,如图10所示,第二次读取的次序O2(0)、O2(1)…的各读取标记位置依然可以由控制器3经式(2)计算后所得,其对应于各标记写入位置I(0)、I(180)…,换句话说,虽然第二次写入时是以由上而下的次序循序写入,但是由于控制器3依然由式(2)计算出所需取出区块O2(0)、O2(1)…的相对应标记位置为I(0)、I(180)…,因此读取出的输出资料流依然是以像块为单位。When reading the O 1 (639) block for the first time, as shown in Figure 9, the second reading can be continued [the second writing is still in progress], as shown in Figure 10, the second The position of each read mark in the sequence O 2 (0), O 2 (1) ... of the second read can still be calculated by the controller 3 through formula (2), which corresponds to the write position of each mark I (0) , I(180)... In other words, although the second writing is written sequentially from top to bottom, since the controller 3 still calculates the required fetch block O 2 according to formula (2) (0), O 2 (1) .

因此,上述写入、读取的动作反复进行,就能够持续地将资料流转换为像块输出,由于随着写入、读取的次数增加,其变化也渐复杂,所以在此不再详细说明。但是需知,由于区分出复数个大小相等的区块,再加以标记出各区块位置,因此即便输入资料流的资料被分别储存于不相邻近的区块中,控制器3也能进一步以式(2)连同式(3)一并计算出所需取出资料的标记位置,能够正确地输出所欲的资料流。Therefore, the above-mentioned writing and reading operations are repeated, and the data stream can be continuously converted into pixel output. As the number of writing and reading increases, the changes become more and more complicated, so I will not go into details here. illustrate. However, it should be known that since a plurality of blocks of equal size are distinguished and the positions of each block are marked, even if the data of the input data stream are stored in non-adjacent blocks, the controller 3 can further use Equation (2) together with Equation (3) calculates the mark position of the data to be retrieved, and can output the desired data flow correctly.

此外,举凡JPEG的静态影像压缩,是分别对红(R)、绿(G)、蓝(B)三原色来分别处理,因此通常具有三组相同的缓冲记忆体1,本例中为简化说明起见,只以单一缓冲记忆体1来作说明,但是熟习此技者应知本发明的技术也能推演至多组缓冲装置100并行的状态。In addition, for JPEG static image compression, the three primary colors of red (R), green (G) and blue (B) are processed separately, so there are usually three sets of the same buffer memory 1. In this example, for the sake of simplification , only a single buffer memory 1 is used for illustration, but those skilled in the art should know that the technology of the present invention can also be deduced to the state of multiple groups of buffer devices 100 in parallel.

实施例2Example 2

参阅图3与图11,本发明的第二较佳实施例其架构与第一较佳实施例相同,所以不再详细说明。惟本实施例是用来将以像块为主的输入资料流转换为以线为主的输出资料流,即本实施例是第一较佳实施例的逆工程,可以使用在例如MPEG、JPEG解压缩过程中的最后段。Referring to FIG. 3 and FIG. 11 , the structure of the second preferred embodiment of the present invention is the same as that of the first preferred embodiment, so it will not be described in detail again. However, this embodiment is used to convert the input data stream mainly based on blocks into an output data stream mainly based on lines, that is, this embodiment is the reverse engineering of the first preferred embodiment, and can be used in MPEG, JPEG, etc. Last segment during decompression.

本例中也是以一大小为640×8位元组的缓冲记忆体1来作说明,且每一区块也是区分为8×1个位元组。写入标记位置与读取标记位置两者间的特定关系式则变成下式:In this example, a buffer memory 1 with a size of 640×8 bytes is also used for illustration, and each block is also divided into 8×1 bytes. The specific relationship between the write mark position and the read mark position then becomes the following:

                On(t)=In((t%w)×h+t/w)  (4) On (t)= In ((t%w)×h+t/w) (4)

其中,h是像块的高度,w是缓冲记忆体1一列所具有的区块数目,而「t%w」是指t除以w后所得的余数,「t/w」是指t除以w所得的商。即利用式(4),可由写入标记位置及其写入次序,得知相对应的读取标记位置及其读取次序。Among them, h is the height of the image block, w is the number of blocks in a column of the buffer memory, and "t%w" refers to the remainder obtained after dividing t by w, and "t/w" refers to dividing t by The quotient obtained by w. That is, using formula (4), the corresponding position of the read mark and its read order can be known from the position of the write mark and its write order.

由于w=80,h=8,所以式(4)成为:Since w=80, h=8, so formula (4) becomes:

                On(t)=In((t%80)×8+t/80)(5)On(t)=In((t%80)×8+t/80)(5)

以下将说明写入资料的过程与利用式(5)读取资料的过程:The following will describe the process of writing data and the process of reading data using formula (5):

(1)第一次写入(1) Write for the first time

参阅图11,在进行写入时,由于输入资料流乃是以区块为主,所以控制器3是参照标记记忆体2中的写入标记位置,循序依I1(0)、I1(1)…I1(639)的顺序写入资料至各区块中。Referring to FIG. 11 , when writing, since the input data stream is mainly based on blocks, the controller 3 refers to the write-in mark position in the mark memory 2, and sequentially follows I 1 (0), I 1 ( 1)...I 1 (639) sequentially write data into each block.

(2)第一次读取(2) Read for the first time

参阅图12,可以但是不限于,在缓冲记忆体1最后一行(写入标记位置为I1(632)~I1(639))尚未写入资料时,就可以开始进行资料的读取。所读取的区块位置与顺序,可以由控制器3依(5)计算所得O1(0)=I1(0)、O1(1)=I1(8)、O1(2)=I1(16)……,所以控制器3参照标记记忆体2中所要的标记读取位置后,即能由特定的标记位置读取出各区块中的资料,而依序所取出的资料,恰构成一以线为主的输出资料流。Referring to FIG. 12 , it is possible, but not limited to, to start reading data when data has not been written in the last line of the buffer memory 1 (the write mark positions are I 1 ( 632 )˜I 1 ( 639 )). The read block position and order can be calculated by the controller 3 according to (5) O 1 (0)=I 1 (0), O 1 (1)=I 1 (8), O 1 (2) =I 1 (16)..., so after the controller 3 refers to the desired tag reading position in the tag memory 2, the data in each block can be read from the specific tag position, and the data taken out in sequence , just constitutes a line-based output data stream.

另一方面,写入I1(632)~I1(639)区块的动作也持续进行,直至最后区块I1(639)。On the other hand, the operation of writing blocks I 1 ( 632 )˜I 1 ( 639 ) is also continued until the last block I 1 ( 639 ).

(3)第二次写入(3) Second write

在第一次写入结束的同时,由于前述已被读取过的区块O1(0)、O1(1)…等又可被写入资料,因此依据前述式(3):In+1(t)=On(t)再写入资料,即依序由读取标记位置为O1(0)、O1(1)、O1(2)的区块写入资料,使其成为被第二次写入的区块位置I2(0)、I2(1)、I2(2)…,如图13所示。At the same time when the first writing is completed, since the previously read blocks O 1 (0), O1(1)...etc. can be written into data again, according to the above formula (3): I n+ 1 (t)=O n (t) and then write data, that is, write data in the blocks whose read mark positions are O 1 (0), O 1 (1), O 1 (2) in sequence, so that These become block positions I 2 (0), I 2 (1), I 2 (2), . . . to be written for the second time, as shown in FIG. 13 .

(4)第二次读取(4) The second read

参阅图14,当第一次读取已届O1(639)区块后,即可以接续第二次读取,如图15所示,第二次读取的次序O2(0)、O2(1)……的各读取标记位置可以由控制器3经式(5)计算后,由标记记忆体2中所得,其对应于各标记写入位置I2(0)、I2(8)、I2(16)……。因此,虽然在第二次写入时是以由左而右的区块循序写入,但是由于控制器3依然由式(2)计算出所需取出区块O2(0)、O2(1)…的相对应标记位置为I(0)、I(8)…,因此读取出的资料依然是由像块为主解码成以线为主资料流后输出。Referring to FIG. 14 , after the first read of the O 1 (639) block, the second read can be continued, as shown in FIG. 15 , the order of the second read O 2 (0), O 2 (1) ... each reading mark position can be obtained from the mark memory 2 after being calculated by the controller 3 through formula (5), which corresponds to each mark writing position I 2 (0), I 2 ( 8), I 2 (16).... Therefore, although the blocks are sequentially written from left to right during the second writing, the controller 3 still calculates the required blocks O 2 (0), O 2 ( 1) The corresponding mark positions of ... are I(0), I(8) ..., so the read data is still decoded from the block-based to the line-based data flow and then output.

因此,控制器依据上述式(3)与式(5),能知所欲写入的区块以及所欲读取的区块次序,即便所欲取出的区块已不相邻,亦能够正确地进行资料的读取与写入动作。Therefore, the controller can know the order of the blocks to be written and the sequence of the blocks to be read according to the above formula (3) and formula (5), even if the blocks to be taken out are no longer adjacent, the sequence can be correct read and write data in a timely manner.

Claims (12)

1. a data stream translation method can be changed to one based on the output information stream as piece with an input data circulation based on line, it is characterized in that:
This method comprises the following steps:
A) buffer memory is marked in regular turn the mark position that writes corresponding to the identical block of a plurality of sizes;
B), write this input data in proper order and flow to respectively in this block according to respectively this writes mark position;
C) according to respectively this writes mark position and the corresponding order that writes, calculate desire to read block read mark position and corresponding output order; And
D) according to this output order, in regular turn from reading data, to export this output information stream corresponding to the block of this mark position respectively.
2. method according to claim 1 is characterized in that:
This step C) be by one first following particular kind of relationship formula:
O n(t)=I n((t%h)×w+t/h)
Calculate this and read mark position, O (t) is that this reads mark position when reading order and being t, this I (t) is that this writes mark position when writing order and being t, h is this height as piece, w is these number of blocks that this buffer memory overall width is had, " t%h " be t divided by h after the remainder of gained, " t/h " be t divided by h after the merchant of gained.
3. the method for claim 1 is characterized in that:
This first particular kind of relationship formula also meets one second particular kind of relationship formula:
I n+1(t)=O n(t)
I.e. this mark position that reads of block after reading writes mark position for write fashionable this next time, and this order that reads of this block after reading is this order that writes next time.
4. a data stream translation method can be changed to an output information stream based on line based on the input data circulation as piece with one, it is characterized in that:
This method comprises the following steps:
A) buffer memory is marked in regular turn the mark position that writes corresponding to a plurality of big or small same block;
B), write this input data in proper order and flow to respectively in this block according to respectively this writes mark position;
C) according to respectively this writes mark position and the corresponding order that writes, calculate desire to read block read mark position and corresponding output order; And
D) according to this output order, in regular turn from reading data, to export this output information stream corresponding to the block of this mark position respectively.
5. method as claimed in claim 4 is characterized in that:
This step c) is by following one the 3rd particular kind of relationship formula:
O n(t)=I n((t%w)×h+t/w)
Calculate this and read mark position, O (t) is that this reads mark position when reading order and being t, this I (t) is that this writes mark position when writing order and being t, h is this height as piece, w is these number of blocks that this buffer memory overall width is had, " t%w " be t divided by w after the remainder of gained, " t/w " be t divided by w after the merchant of gained.
6. the method for claim 1 is characterized in that:
The 3rd particular kind of relationship formula also meets one the 4th particular kind of relationship formula:
I n+1(t)=O n(t)
I.e. this mark position that reads of block after reading writes mark position for write fashionable this next time, and this order that reads of this block after reading writes order for next time this.
7. a snubber assembly becomes one based on the output information stream as piece in order to change the input data stream based on line, comprises a buffer memory, a mark memory body and a buffer control unit, it is characterized in that:
The block that this buffer memory physical efficiency is partitioned into logically that complex magnitude equates and writes for this input data stream, these blocks also write order according to one and are labeled out plural number and write mark position;
This mark memory used for storing is the pairing entity mark position of this block respectively;
This buffer control unit is in order to write order according to this and these write mark position, calculate and desire to read one of these blocks and read order and and read mark position, the data of this block becomes this output information stream further to read out respectively by the entity mark position of this block respectively.
8. snubber assembly as claimed in claim 1 is characterized in that:
This buffer control unit is according to following one first particular kind of relationship formula:
On(t)=In((t%h)×w+t/h)
Calculate this and read mark position, O (t) is that this reads mark position when reading order and being t, this I (t) is that this writes mark position when writing order and being t, h is this height as piece, w is these number of blocks that this buffer memory overall width is had, " t%h " be t divided by h after resulting remainder, " t/h " be t divided by h after resulting merchant.
9. snubber assembly as claimed in claim 8 is characterized in that:
This first particular kind of relationship formula also meets one second particular kind of relationship formula:
I n+1(t)=O n(t)
I.e. this mark position that reads of block after reading writes mark position for write fashionable this next time, and this order that reads of this block after reading is this order that writes next time.
10. snubber assembly becomes an output information stream based on line in order to change one based on the input data stream as piece, and this snubber assembly comprises a buffer memory, a mark memory body and a buffer control unit, it is characterized in that:
The block that this buffer memory physical efficiency is partitioned into logically that complex magnitude equates and writes for this input data stream, these blocks also write order according to one and are labeled out plural number and write mark position;
This mark memory used for storing is the pairing entity mark position of this block respectively;
This buffer control unit is in order to write order according to this and these write mark position, calculate and desire to read one of these blocks and read order and and read mark position, the data of this block becomes this output information stream further to read out respectively by the entity mark position of this block respectively.
11. snubber assembly as claimed in claim 10 is characterized in that:
This buffer control unit is according to following one the 3rd particular kind of relationship formula:
O n(t)=I n((t%w)×h+t/w)
Calculate this and read mark position, O (t) is that this reads mark position when reading order and being t, this I (t) is that this writes mark position when writing order and being t, h is this height as piece, w is these number of blocks that this buffer memory overall width is had, " t%w " be t divided by w after resulting remainder, " t/w " be t divided by w after resulting merchant.
12. snubber assembly as claimed in claim 11 is characterized in that:
The 3rd particular kind of relationship formula also meets one the 4th particular kind of relationship formula:
I n+1(t)=O n(t)
I.e. this mark position that reads of block after reading writes mark position for write fashionable this next time, and this order that reads of this block after reading writes order for next time this.
CN 200310103402 2003-10-31 2003-10-31 Data stream conversion method and buffer device Expired - Fee Related CN1291324C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200310103402 CN1291324C (en) 2003-10-31 2003-10-31 Data stream conversion method and buffer device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200310103402 CN1291324C (en) 2003-10-31 2003-10-31 Data stream conversion method and buffer device

Publications (2)

Publication Number Publication Date
CN1612111A true CN1612111A (en) 2005-05-04
CN1291324C CN1291324C (en) 2006-12-20

Family

ID=34756654

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200310103402 Expired - Fee Related CN1291324C (en) 2003-10-31 2003-10-31 Data stream conversion method and buffer device

Country Status (1)

Country Link
CN (1) CN1291324C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI798034B (en) * 2022-03-23 2023-04-01 慧榮科技股份有限公司 Memory controller and data processing method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
TWI798034B (en) * 2022-03-23 2023-04-01 慧榮科技股份有限公司 Memory controller and data processing method
US12223173B2 (en) 2022-03-23 2025-02-11 Silicon Motion, Inc. Memory controller and data processing method for processing disordered read-out data

Also Published As

Publication number Publication date
CN1291324C (en) 2006-12-20

Similar Documents

Publication Publication Date Title
US8989263B2 (en) Inverse quantizer supporting multiple decoding processes
CN113170140B (en) Method for encoding data element, method for decoding data stream, device and medium
CN101030365A (en) Digital image storage displaying method and device
JP2017184250A (en) Apparatus and method for decoding using coefficient compression
CN1893659A (en) DCT compression using Golomb-Rice coding
CN1798341A (en) Adaptive coefficient scan order
CN103262531B (en) For the method and apparatus that storage compression ratio is indicated in pixel value buffer in encoding in segment
CN109889846B (en) Method and device for compressing and decompressing Demura table data and coding and decoding system
CN1290339C (en) Compressed moving image decompression device and image display device using the same
TWI236605B (en) Data flow conversion method and its buffer device
CN102970544A (en) JPEG (Joint Photographic Experts Group) encoding and decoding method and JPEG encoding and decoding system
CN1118470A (en) Image processing apparatus
CN1719435A (en) Device and method for performing discrete cosine transform/inverse discrete cosine transform
CN1369175A (en) Method and device for increasing use of memory resource in information flow decoder
CN1791219A (en) Dual layer bus architecture for system-on-a-chip
CN1574967A (en) Compressor arrangement for moving images and video taking device using the same
CN1291324C (en) Data stream conversion method and buffer device
CN112422985B (en) Multi-core parallel hardware coding method and device suitable for JPEG
CN114387356B (en) A PNG format encoding and decoding method and device
CN105992003A (en) Method and device for image compression of palette color number based on order or frequency
CN1708123A (en) Decoding device with multiple buffers
JP2004509528A (en) Data transfer between RGB color space and YCrCb color space for DCT interface
CN1976475A (en) Image processing device and method
CN1692625A (en) Image conversion device, image conversion method, and recording medium
CN1574977A (en) Method and device for changing image size

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20061220

Termination date: 20201031

CF01 Termination of patent right due to non-payment of annual fee