CN102868869B - Image compression method and decompression method with fixed compression ratio and electronic device thereof - Google Patents
Image compression method and decompression method with fixed compression ratio and electronic device thereof Download PDFInfo
- Publication number
- CN102868869B CN102868869B CN201110195750.5A CN201110195750A CN102868869B CN 102868869 B CN102868869 B CN 102868869B CN 201110195750 A CN201110195750 A CN 201110195750A CN 102868869 B CN102868869 B CN 102868869B
- Authority
- CN
- China
- Prior art keywords
- image
- compressed
- row
- bit stream
- field
- 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.)
- Expired - Fee Related
Links
- 230000006835 compression Effects 0.000 title claims abstract description 69
- 238000007906 compression Methods 0.000 title claims abstract description 69
- 238000000034 method Methods 0.000 title claims abstract description 47
- 230000006837 decompression Effects 0.000 title claims abstract description 20
- 238000010586 diagram Methods 0.000 description 6
- 230000006870 function Effects 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 1
- 238000009434 installation Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
Description
技术领域 technical field
本发明涉及一种影像压缩方法、解压缩方法及其电子装置,特别涉及一种用于数字影像的原始数据(raw data)的固定压缩倍率的影像压缩方法、解压缩方法及其电子装置。The present invention relates to an image compression method, a decompression method and an electronic device thereof, in particular to an image compression method, a decompression method and an electronic device thereof with a fixed compression ratio for digital image raw data.
背景技术 Background technique
数码相机等装置最初由电荷耦合装置(charge coupled device,CCD)等多图场感测器(multi-field sensor)所能得到的数据是原始数据(raw data),原始数据尚须经过影像处理装置进行许多的处理才能提供给使用者观赏。但是现有压缩原始数据的技术多采用无失真压缩(lossless compression)或是非视觉性失真压缩(not visible lossy compression),而难以控制压缩后的文件大小。此类压缩方式能够节省的空间并不一定,只能在实际压缩完后确认省下了多少储存空间。最新的影像信号处理器(image signal processor,ISP)多改用以影像排(band)为单位处理。但以多图场感测器并非以固定的顺序输出原始数据,因此会产生难以同时兼顾多图场感测器输出的图场次序以及以影像排为单位处理的问题。尤其在如何在压缩后的比特流中,兼顾上述两者以界定图场以及影像排的边界十分地困难。Digital cameras and other devices initially obtain data from multi-field sensors such as charge coupled devices (CCDs) as raw data, which must be processed by image processing devices. A lot of processing can be provided for users to watch. However, the existing technologies for compressing raw data mostly use lossless compression or non-visual lossy compression, and it is difficult to control the compressed file size. The space saved by this kind of compression method is not certain, and it can only be confirmed how much storage space is saved after the actual compression is completed. The latest image signal processor (image signal processor, ISP) mostly uses image band as the unit for processing. However, the multi-field sensor does not output the original data in a fixed order, so it is difficult to simultaneously consider the field order output by the multi-field sensor and the processing in units of image rows. Especially in the compressed bit stream, it is very difficult to balance the above two to define the boundary of the image field and the video row.
此外,即使只需影像中部分的影像排,最直觉的方法就是将整个压缩结果解码回全分辨率(full resolution)后,再选取所需的部分作进一步的处理。这种做法需要预备有能够容纳全分辨率的影像的记忆体。且随着时代进步,影像的分辨率增长快速,更加重了解码时的负担。In addition, even if only part of the image is needed, the most intuitive way is to decode the entire compressed result back to full resolution (full resolution), and then select the required part for further processing. This approach requires the provision of memory capable of holding full-resolution images. And with the progress of the times, the resolution of images increases rapidly, which increases the burden of decoding.
发明内容 Contents of the invention
为了解决上述问题,本发明的目的在于提供一种固定压缩倍率的影像压缩方法、影像解压缩方法及其电子装置,可以解决现有技术中难以兼顾图场顺序以及影像排边界的问题。In order to solve the above problems, the object of the present invention is to provide an image compression method with a fixed compression ratio, an image decompression method and an electronic device thereof, which can solve the problem that it is difficult to take into account the image field order and the image row boundary in the prior art.
电子装置包括一多图场感测器(multi-field sensor)、一记忆体以及一编解码器封套模块(codec wrapper module)。多图场感测器以一图场次序产生一影像的一原始数据(raw data),其中影像包括多个图列(line),且每一个图列对应一图场索引(field index)。编解码器封套模块包括至少一编码器及至少一解码器,其分别执行固定压缩倍率的影像压缩方法以及影像解压缩方法。The electronic device includes a multi-field sensor, a memory and a codec wrapper module. The multi-field sensor generates raw data of an image in a field order, wherein the image includes multiple lines, and each line corresponds to a field index. The codec wrapper module includes at least one encoder and at least one decoder, which respectively implement a fixed compression ratio image compression method and an image decompression method.
固定压缩倍率的影像压缩方法将影像的原始数据以一预定倍率压缩成一影像比特流(bit stream)。固定压缩倍率的影像压缩方法包括:将影像分割为多个影像排,其中每一个影像排包括至少一个图列;依据压缩倍率以及原始数据的一比特流长度,于记忆体内指定一存放空间;依据压缩倍率以及原始数据的比特流长度,将存放空间分割为多个压缩排区,压缩排区分别对应于影像排;纪录每一个压缩排区的起始位置为一目前终止位置;依序接收图列;将这些图列分别压缩成为多个压缩比特流;以及依据这些图列的图场索引、多图场感测器输出的图场次序以及与图列对应的影像排组成的群组,以一写入程序依序将压缩比特流写入对应的压缩排区。The image compression method with a fixed compression ratio compresses the original data of the image into an image bit stream at a predetermined ratio. The image compression method with a fixed compression ratio includes: dividing the image into a plurality of image rows, wherein each image row includes at least one image row; specifying a storage space in the memory according to the compression ratio and the length of a bit stream of the original data; The compression ratio and the length of the bit stream of the original data divide the storage space into multiple compressed rows, which correspond to the image row respectively; record the starting position of each compressed row as a current end position; receive the pictures sequentially columns; compressing these image columns into a plurality of compressed bit streams respectively; A writing process sequentially writes the compressed bit stream into the corresponding compressed row.
编码器执行的写入程序可包括:接收一个压缩比特流;依据与压缩比特流对应的图场以及影像排,由对应的压缩排区的目前终止位置开始将压缩比特流写入对应的压缩排区;以及当压缩比特流对应的图列不为所属的影像排的最后一个图列时,更新对应的压缩排区的目前终止位置。其中的“所属的影像排的最后一个图列”,是指此图列为其所属的影像排中,依照图场次序被接收的最后一个图列。写入程序还可包括:当压缩比特流对应的图列为所属的影像排的最后一个图列时,在写入的压缩比特流后以一填充码填满对应的压缩排区。The writing procedure performed by the encoder may include: receiving a compressed bit stream; writing the compressed bit stream into the corresponding compressed bit stream from the current end position of the corresponding compressed bit stream according to the field and image bank corresponding to the compressed bit stream area; and when the image row corresponding to the compressed bit stream is not the last image row of the image row to which it belongs, update the current end position of the corresponding compressed row area. The "last image sequence of the image row to which it belongs" refers to the last image sequence received according to the field order in the image row to which the image sequence belongs. The writing procedure may further include: when the image row corresponding to the compressed bit stream is the last image row of the associated image row, filling the corresponding compressed row area with a filling code after the compressed bit stream to be written.
影像解压缩方法是用于将编码器压缩成的影像比特流解码。影像解压缩方法包括:接收影像比特流的至少一个压缩排区;以及依据图场次序,将压缩排区中的这些压缩比特流解压缩回与压缩排区对应的影像排中的图列。The video decompression method is used to decode the video bitstream compressed by the encoder. The image decompression method includes: receiving at least one compressed row of image bitstreams; and decompressing the compressed bitstreams in the compressed row to a map sequence in the image row corresponding to the compressed row according to the field order.
影像解压缩方法中,“依据图场次序,将压缩排区中的这些压缩比特流解压缩回与压缩排区对应的影像排中的图列”的步骤可包括:计算压缩排区内分别对应这些图场的多个图列数;以及依据图场次序以及图列数,将压缩排区中的这些压缩比特流解压缩回与压缩排区对应的影像排的图列。In the image decompression method, the step of "decompressing these compressed bit streams in the compressed arrangement area back to the image sequence in the image arrangement corresponding to the compressed arrangement area" may include: calculating the respective corresponding bit streams in the compressed arrangement area A plurality of picture sequences of the fields; and decompressing the compressed bit streams in the compressed arrangement area to the image arrangement corresponding to the compressed arrangement area according to the order of the fields and the number of the image arrangements.
根据本发明的一实施范例,电子装置还可包括至少一记忆体总线(memorybus)以及一应用模块。记忆体总线电性连接于编解码器封套模块以及记忆体之间。而应用模块则电性连接于记忆体总线,并通过记忆体总线存取已被解码器解压缩的至少一个影像排。此外,电子装置也可包括一芯片上随机存取记忆体(on-chip random access memory,OCRAM),以纪录这些压缩排区的目前终止位置。According to an embodiment of the present invention, the electronic device may further include at least a memory bus and an application module. The memory bus is electrically connected between the codec envelope module and the memory. The application module is electrically connected to the memory bus, and accesses at least one image row decompressed by the decoder through the memory bus. In addition, the electronic device may also include an on-chip random access memory (OCRAM) to record the current end positions of the compressed rows.
固定压缩倍率的影像压缩方法,用以将一多图场感测器所产生的一影像的一原始数据以一压缩倍率压缩成一影像比特流,该影像包括多个图列,该多图场感测器将该些图列以一图场次序输出,每一该图列对应一图场索引,该固定压缩倍率的影像压缩方法包括:An image compression method with a fixed compression ratio is used to compress an original data of an image generated by a multi-field sensor into an image bit stream at a compression ratio. The image includes a plurality of image columns, and the multi-field sensor The detector outputs these image sequences in a field sequence, and each image sequence corresponds to a field index. The image compression method with a fixed compression ratio includes:
将该影像分割为多个影像排,其中每一该影像排包括至少一该图列;dividing the image into a plurality of image rows, wherein each image row includes at least one of the image columns;
依据该压缩倍率以及该原始数据的一比特流长度,于一记忆体内指定一存放空间;Designate a storage space in a memory according to the compression ratio and a bit stream length of the original data;
依据该压缩倍率以及该原始数据的该比特流长度,将该存放空间分割为多个压缩排区,该些压缩排区分别对应于该些影像排;According to the compression ratio and the length of the bit stream of the original data, the storage space is divided into a plurality of compressed row areas, and the compressed row areas correspond to the image rows respectively;
纪录每一该压缩排区的起始位置为一目前终止位置;record the start position of each compressed area as a current end position;
依序接收该些图列;receiving the graphs sequentially;
将该些图列分别压缩成为多个压缩比特流;以及Compressing the graphs into a plurality of compressed bitstreams respectively; and
依据该些图列的该些图场索引、该多图场感测器输出的该图场次序以及与该些图列对应的该些影像排组成的群组,以一写入程序依序将该些压缩比特流写入对应的该些压缩排区。According to the group consisting of the field indexes of the image columns, the field order output by the multi-field sensor, and the image rows corresponding to the image columns, a writing process is used to sequentially write The compressed bit streams are written into the corresponding compressed rows.
以下结合附图和具体实施例对本发明进行详细描述,但不作为对本发明的限定。The present invention will be described in detail below in conjunction with the accompanying drawings and specific embodiments, but not as a limitation of the present invention.
附图说明 Description of drawings
图1为根据本发明一实施范例的电子装置的示意图;FIG. 1 is a schematic diagram of an electronic device according to an embodiment of the present invention;
图2为根据本发明一实施范例的影像排的示意图;FIG. 2 is a schematic diagram of an image row according to an embodiment of the present invention;
图3为根据本发明一实施范例的固定压缩倍率的影像压缩方法的流程图;3 is a flowchart of an image compression method with a fixed compression ratio according to an embodiment of the present invention;
图4为根据本发明一实施范例的写入程序的流程图;FIG. 4 is a flowchart of a writing program according to an embodiment of the present invention;
图5A~图5F为根据本发明一实施范例的写入过程的记忆体示意图;5A-5F are memory schematic diagrams of a writing process according to an embodiment of the present invention;
图6为根据本发明一实施范例的步骤S106的流程图;FIG. 6 is a flowchart of step S106 according to an implementation example of the present invention;
图7A为根据本发明一实施范例的影像解压缩的流程图;FIG. 7A is a flow chart of image decompression according to an embodiment of the present invention;
图7B为根据本发明另一实施范例的影像解压缩的流程图;以及FIG. 7B is a flow chart of image decompression according to another embodiment of the present invention; and
图7C为根据本发明又一实施范例的影像解压缩的流程图。FIG. 7C is a flow chart of image decompression according to yet another embodiment of the present invention.
其中,附图标记Among them, reference signs
20 电子装置20 electronic devices
22 多图场感测器22 Multi-field sensor
24 编解码器封套模块24 codec wrapper modules
241 编码器241 encoder
242 解码器242 decoder
25 记忆体25 memory
26 记忆体总线26 memory bus
27 芯片上随机存取记忆体27 On-chip random access memory
28 应用模块28 application modules
30 影像30 images
32,32a,32b影像排32, 32a, 32b image row
34,34_1~34_m图列34, 34_1 ~ 34_m picture series
40 存放空间40 storage space
42a,42b压缩排区42a, 42b compression row area
44a,44b目前终止位置44a, 44b current termination position
46 压缩比特流46 compressed bitstream
48 填充码48 padding code
具体实施方式 Detailed ways
下面结合附图对本发明的结构原理和工作原理作具体的描述:Below in conjunction with accompanying drawing, structural principle and working principle of the present invention are specifically described:
本发明提供一种固定压缩倍率的影像压缩方法、影像解压缩方法及其电子装置,以将一多图场感测器(multi-field sensor)所产生的一影像的一原始数据(raw data)以一压缩倍率压缩成一影像比特流(bit stream),或是将影像比特流解压缩(解码)回原始数据。The present invention provides an image compression method with a fixed compression ratio, an image decompression method and an electronic device thereof, so as to convert a raw data (raw data) of an image generated by a multi-field sensor Compress into an image bit stream with a compression ratio, or decompress (decode) the image bit stream back to the original data.
首先请参照图1,其为根据本发明一实施范例的电子装置的示意图。电子装置20包括多图场感测器22、一编解码器封套模块(codec wrapper module)24以及一记忆体25。编解码器封套模块24中可包括至少一编码器241以执行固定压缩倍率的影像压缩方法,或/且至少一解码器242以执行影像解压缩方法。而电子装置20可以是数码相机、附有照相功能的手机或是附有照相功能的笔记型计算机等能够以多图场感测器22撷取影像,并具有编码器241或/且解码器242的装置。First, please refer to FIG. 1 , which is a schematic diagram of an electronic device according to an embodiment of the present invention. The electronic device 20 includes a multi-field sensor 22 , a codec wrapper module 24 and a memory 25 . The codec wrapper module 24 may include at least one encoder 241 for performing an image compression method with a fixed compression ratio, or/and at least one decoder 242 for performing an image decompression method. The electronic device 20 can be a digital camera, a mobile phone with a camera function, or a notebook computer with a camera function, etc., which can capture images with a multi-field sensor 22 and have an encoder 241 or/and a decoder 242 installation.
多图场感测器22可以例如是电荷耦合装置(charge coupled device,CCD),其以一图场次序产生影像的原始数据。请同时参照图2,其为根据本发明一实施范例的影像排的示意图。影像30包括多个图列(line)34,多图场感测器22则将所有图列34以图场次序输出。每一个图列34对应有一图场索引(fieldindex),代表此图列34是属于哪一个图场。以图2的实施范例而言,多图场感测器22将影像30分为3个图场,并依据图场1、图场2以及图场3的图场次序将图列34输出。因此多图场感测器22依据图场次序将图列34按照34_1、34_4…34_n-2、34_n+1…34_m-2、34_2、34_5…34_n-1、34_n+2…34_m-1、34_3、34_6…34_n、34_n+3…34_m依序输出,其中n与m为3倍数的正整数,且m大于n。The multi-field sensor 22 can be, for example, a charge coupled device (CCD), which generates raw image data in a field order. Please also refer to FIG. 2 , which is a schematic diagram of an image row according to an embodiment of the present invention. The image 30 includes a plurality of lines 34, and the multi-field sensor 22 outputs all the lines 34 in field order. Each image row 34 corresponds to a field index (fieldindex), representing which field the image row 34 belongs to. Taking the implementation example of FIG. 2 as an example, the multi-field sensor 22 divides the image 30 into three fields, and outputs the image sequence 34 according to the field order of field 1 , field 2 , and field 3 . Therefore, the multi-field sensor 22 divides the image sequence 34 into 34_1, 34_4...34_n-2, 34_n+1...34_m-2, 34_2, 34_5...34_n-1, 34_n+2...34_m-1, 34_3 according to the field order. , 34_6...34_n, 34_n+3...34_m are output sequentially, where n and m are positive integers that are multiples of 3, and m is greater than n.
然而本说明书中仅以此为例,并不限制多图场感测器22分割的图场数量、一图列数以及输出的图场次序。其中一影像排(band)32中每一个图场对应的图列34的数量称之为图列数。However, this description is only taken as an example, and does not limit the number of fields divided by the multi-field sensor 22 , the number of a column, and the order of fields output. The number of image columns 34 corresponding to each image field in an image band 32 is referred to as the number of image columns.
记忆体25可被分割为不同区域,以分开储存已压缩的影像比特流以及将影像比特流解压缩的结果。电子装置20还可具有至少一记忆体总线26,其将编解码器封套模块24以记忆体25电性连接。记忆体25可以例如是双数据率记忆体(Double Data Rate memory,DDR memory)、动态随机存取记忆体(Dynamic Random Access Memory,DRAM)或是闪存(Flash memory)。The memory 25 can be divided into different areas to separately store the compressed image bitstream and the result of decompressing the image bitstream. The electronic device 20 can also have at least one memory bus 26 electrically connecting the codec wrapper module 24 with the memory 25 . The memory 25 can be, for example, a double data rate memory (Double Data Rate memory, DDR memory), a dynamic random access memory (Dynamic Random Access Memory, DRAM) or a flash memory (Flash memory).
请参照图3,其为根据本发明一实施范例的固定压缩倍率的影像压缩方法的流程图。首先将影像30分割为多个影像排32,其中每一个影像排32包括至少一个图列34(步骤S101)。例如在图2中,影像30被分割成两个影像排32a以及32b;而图列34_1~34_n与图列34_n+1~34_m分别属于影像排32a与32b。但影像30也可依需求被分割为更多的影像排32。Please refer to FIG. 3 , which is a flowchart of an image compression method with a fixed compression ratio according to an embodiment of the present invention. First, the image 30 is divided into a plurality of image rows 32, wherein each image row 32 includes at least one image row 34 (step S101). For example, in FIG. 2 , the image 30 is divided into two image rows 32a and 32b; and the image rows 34_1˜34_n and the image rows 34_n+1˜34_m belong to the image rows 32a and 32b respectively. However, the image 30 can also be divided into more image rows 32 as required.
编码器241依据压缩倍率以及原始数据的一比特流长度,于记忆体25内指定(allocate)一存放空间(步骤S102)。依据压缩倍率以及原始数据的比特流长度,将存放空间分割为多个压缩排区,这些压缩排区是分别对应于影像排32(步骤S103)。且编码器241并纪录每一个压缩排区的起始位置为一目前终止位置(步骤S104)。The encoder 241 allocates a storage space in the memory 25 according to the compression factor and the length of a bit stream of the original data (step S102 ). According to the compression ratio and the length of the bit stream of the original data, the storage space is divided into a plurality of compressed row areas, and these compressed row areas correspond to the image row 32 respectively (step S103 ). And the encoder 241 records the starting position of each compressed extent as a current ending position (step S104).
电子装置20可还包括一芯片上随机存取记忆体(on-chip random accessmemory,OCRAM)27,以储存每一个压缩排区的目前终止位置。芯片上随机存取记忆体27除了用以储存目前终止位置之外,还可供电子装置20内部的其它模块使用。此外,电子装置20也可在编解码器封套模块24内配置一个随机存取记忆体或多个缓存器(register),专门用来储存目前终止位置。The electronic device 20 may further include an on-chip random access memory (OCRAM) 27 for storing the current end position of each compressed row. The on-chip random access memory 27 can be used by other modules inside the electronic device 20 in addition to storing the current end position. In addition, the electronic device 20 may also configure a random access memory or a plurality of registers in the codec wrapper module 24 for storing the current termination position.
接着编码器241由多图场感测器22依序接收所有图列34(步骤S105),并将这些图列34分别压缩成为多个压缩比特流(步骤S106)。且依据每一个图列34的图场索引、多图场感测器22输出的图场次序以及与此图列34对应的影像排32组成的群组,编码器241以一写入程序依序将压缩比特流写入对应的压缩排区(步骤S107)。更详细地说,编解码器封套模块24是不断重复接收一个图列34、将此图列34压缩成压缩比特流,以及以写入程序将此压缩比特流写入压缩排区,直到整个原始数据被压缩以及写入存放空间成为此影像比特流。而影像比特流也就是填满压缩比特流以及填充码的存放空间内的数据。Then the encoder 241 sequentially receives all the pictures 34 from the multi-field sensor 22 (step S105 ), and compresses these pictures 34 into a plurality of compressed bit streams (step S106 ). And according to the field index of each picture row 34, the field sequence output by the multi-field sensor 22 and the group formed by the image row 32 corresponding to the picture row 34, the encoder 241 uses a writing procedure to sequentially Write the compressed bit stream into the corresponding compressed row (step S107). In more detail, the codec wrapper module 24 is to repeatedly receive a picture sequence 34, compress the picture sequence 34 into a compressed bit stream, and write the compressed bit stream into the compressed row area with a writing program until the entire original The data is compressed and written into the storage space to become the image bitstream. The image bit stream is the data that fills the storage space of the compressed bit stream and the padding code.
请参照图4,其为根据本发明一实施范例的写入程序的流程图。写入程序首先接收一个压缩比特流(步骤S111),并依据与此压缩比特流对应的图场以及影像排32,由与此影像排32对应的压缩排区的目前终止位置开始,将此压缩比特流写入对应的压缩排区(步骤S112)。换句话说,写入程序判断图场索引以及压缩成此压缩比特流的图列34所属的影像排32。Please refer to FIG. 4 , which is a flowchart of a writing procedure according to an embodiment of the present invention. The writing program first receives a compressed bit stream (step S111), and according to the field corresponding to the compressed bit stream and the image row 32, the compressed bit stream is compressed from the current end position of the compressed row area corresponding to the image row 32. The bit stream is written into the corresponding compressed row (step S112). In other words, the writing program determines the field index and the image row 32 to which the image sequence 34 compressed into the compressed bit stream belongs.
根据本发明的一实施范例,步骤S112可包括:依据图场次序以及每一个图场对应的图列34的数量,计算与此压缩比特流对应的图场(即图场索引);以及依据每一个影像排32所包括的图列34的数量以及每一个图场对应的图列34的数量,计算与此压缩比特流对应的影像排32。According to an exemplary implementation of the present invention, step S112 may include: calculating the fields corresponding to the compressed bit stream (namely field index) according to the order of fields and the number of picture columns 34 corresponding to each field; The number of picture rows 34 included in one video row 32 and the number of picture rows 34 corresponding to each field are used to calculate the video row 32 corresponding to the compressed bit stream.
将此压缩比特流写入后,写入程序判断此压缩比特流对应的图列34是否为所属的影像排32的最后一个图列34(步骤S113)。其中的“所属的影像排32的最后一个图列34”,是指此图列34为其所属的影像排32中,依照图场次序被扫描以及接收的最后一个图列34。当此压缩比特流对应的图列34不是所属的影像排32的最后一个图列34时,更新对应的压缩排区的目前终止位置(步骤S114)。而当此压缩比特流对应的图列34是所属的影像排32的最后一个图列34时,在写入的压缩比特流后以一填充码填满对应的压缩排区(步骤S115)。After the compressed bit stream is written, the writing program judges whether the picture sequence 34 corresponding to the compressed bit stream is the last picture sequence 34 of the corresponding image row 32 (step S113 ). The "last image row 34 of the image row 32 to which it belongs" refers to the last image row 34 scanned and received in the image row 32 to which the image row 34 belongs according to the field order. When the picture row 34 corresponding to the compressed bit stream is not the last picture row 34 of the corresponding image row 32, update the current end position of the corresponding compressed row (step S114). And when the picture row 34 corresponding to the compressed bitstream is the last picture row 34 of the associated image row 32, a padding code is used to fill the corresponding compressed row area after the written compressed bitstream (step S115).
于步骤S115中,编解码器封套模块24判断在压缩排区内写入最后一个压缩比特流后此压缩排区内是否还有空间。若是,编解码器封套模块24便补上填充码。因此每一个压缩排区的起始位置都是存放一个影像排32中第一个依照图场次序被扫描的图列34的压缩比特流。In step S115 , the codec wrapper module 24 determines whether there is still room in the compressed row after the last compressed bitstream is written in the compressed row. If so, the codec wrapper module 24 adds padding codes. Therefore, the starting position of each compressed row area is to store the compressed bit stream of the first image sequence 34 scanned in the field order in an image row 32 .
图列34中的影像内容会影响到压缩出来的结果,因此与每一个压缩排区内的填充码的长度可能有所不同。而填充码中可以所有的位的值都相同,例如全是0或者是全是1。填充码中的值也可不相同。填充码也可以是附加的压缩比特流的一验证码,例如可以是相对应的压缩比特流的校验和(check sum)。The image content in Figure 34 will affect the compressed result, so the length of the padding code in each compressed row may be different. In the stuffing code, all bits may have the same value, for example, all 0s or all 1s. The values in the pad code can also be different. The padding code may also be a verification code of the additional compressed bit stream, for example, it may be a check sum (check sum) of the corresponding compressed bit stream.
请搭配图4参照图5A到图5F,其为根据本发明一实施范例的写入过程的记忆体示意图。Please refer to FIG. 5A to FIG. 5F in conjunction with FIG. 4 , which are schematic diagrams of a memory writing process according to an embodiment of the present invention.
如图5A所示,于步骤S104之后记忆体25内的存放空间40依据影像排32a以及32b被分为压缩排区42a以及42b(以下统称为压缩排区42)。且压缩排区42a以及42b的起始位置分别被纪录为对应其的目前终止位置44a以及44b(以下统称为目前终止位置44)。其中压缩排区42a以及42b的起始位置可以由压缩排区42a以及42b的大小与存放空间40的起始位置计算得到。As shown in FIG. 5A, after step S104, the storage space 40 in the memory 25 is divided into compressed row areas 42a and 42b (hereinafter collectively referred to as compressed row areas 42) according to the image rows 32a and 32b. And the start positions of the compressed row areas 42a and 42b are respectively recorded as the corresponding current end positions 44a and 44b (hereinafter collectively referred to as the current end positions 44 ). Wherein, the starting positions of the compressed row areas 42 a and 42 b can be calculated from the sizes of the compressed row areas 42 a and 42 b and the starting position of the storage space 40 .
由于图场次序是图场1、图场2以及图场3,写入程序接到的第一个压缩比特流46是对应于影像30的第一个图列34_1,而属于第一个影像排32a以及图场1。写入程序将此压缩比特流46写入与影像排32a对应的压缩排区42a,并更新压缩排区42a的目前终止位置44a为被写入的此压缩比特流46的下一个位(bit)的位置,如图5B。Since the field order is field 1, field 2, and field 3, the first compressed bitstream 46 received by the writing program corresponds to the first image sequence 34_1 of the image 30, and belongs to the first image sequence 34_1. 32a and map field 1. The write program writes the compressed bitstream 46 into the compressed row 42a corresponding to the image row 32a, and updates the current end position 44a of the compressed row 42a to be the next bit (bit) of the compressed bitstream 46 written. position, as shown in Figure 5B.
编码器241依序将对应于图列34_1、34_4…34_n-2的压缩比特流46写入压缩排区42a,并逐一更新并保存压缩排区42a的目前终止位置44a。当写入程序接收到对应于图列34_n+1的压缩比特流46后,可在步骤S112得知其属于影像排32b。因此对应于图列34_n+1的压缩比特流46依据目前终止位置44b写入压缩排区42b,如图5C。The encoder 241 sequentially writes the compressed bit streams 46 corresponding to the columns 34_1 , 34_4 . When the writing program receives the compressed bit stream 46 corresponding to the image row 34_n+1, it can be known in step S112 that it belongs to the image row 32b. Therefore, the compressed bit stream 46 corresponding to the column 34_n+1 is written into the compressed row area 42b according to the current end position 44b, as shown in FIG. 5C.
值得注意的是,编码器241是将影像排32a内属于图场1的所有图列34都依序压缩并写入压缩排区42a之后,接着将影像排32b内属于图场1的所有图列34都依序压缩并写入压缩排区42b,再依照图场次序依序写入相对应的压缩排区42。It is worth noting that the encoder 241 sequentially compresses all the pictures 34 belonging to the field 1 in the image row 32a and writes them into the compressed row 42a, and then compresses all the pictures 34 belonging to the field 1 in the image row 32b 34 are sequentially compressed and written into the compressed row 42b, and then sequentially written into the corresponding compressed row 42 according to the field order.
依据上述步骤,影像排32a中图场索引为3的图列34被处理完后,编解码器封套模块24写入填充码48。编码器241才再处理影像排32b中对应于图场索引为3的图列34,如图5D、图5E以及图5F所示。According to the above steps, after the image row 34 with the field index 3 in the image row 32 a is processed, the codec wrapper module 24 writes the padding code 48 . The encoder 241 then processes the image row 34 corresponding to the field index 3 in the image row 32 b, as shown in FIG. 5D , FIG. 5E and FIG. 5F .
请参照图6,其为根据本发明不同实施范例的步骤S106的流程图。根据本发明的一实施范例,步骤S106可包括:以多个压缩窗分割图列34(步骤S1061);依序将每一个压缩窗压缩成一子比特流(步骤S1062);以及将对应于图列34的这些子比特流作为压缩比特流46(步骤S1063)。Please refer to FIG. 6 , which is a flowchart of step S106 according to different implementation examples of the present invention. According to an embodiment of the present invention, step S106 may include: dividing the image sequence 34 with a plurality of compression windows (step S1061); sequentially compressing each compression window into a sub-bit stream (step S1062); These sub-bitstreams of 34 are used as compressed bitstream 46 (step S1063).
接着请参照图7A,其为根据本发明一实施范例的影像解压缩的流程图。解码器242可由记忆体25接收影像比特流的至少一个压缩排区42(步骤S121);再依据图场次序,将压缩排区42中的所有压缩比特流46解压缩回与此压缩排区42对应的影像排32的所有图列34(步骤S122)。Please refer to FIG. 7A , which is a flow chart of image decompression according to an embodiment of the present invention. The decoder 242 can receive at least one compressed row 42 of the image bitstream from the memory 25 (step S121); and then decompress all the compressed bitstreams 46 in the compressed row 42 back to the compressed row 42 according to the field order All the image columns 34 of the corresponding image row 32 (step S122).
电子装置20还可包括至少一应用模块28。应用模块28可通过记忆体总线26得到被解码器242解压缩的影像排32,并将其进行显示或各种数字影像处理(digital image processing,DIP)。由于解码器242可提供单一的影像排32,因此应用模块28不需等到整个影像比特流都被解码就能开始运作。The electronic device 20 can further include at least one application module 28 . The application module 28 can obtain the image row 32 decompressed by the decoder 242 through the memory bus 26, and perform display or various digital image processing (DIP) on it. Since the decoder 242 can provide a single video row 32, the application module 28 does not need to wait for the entire video bitstream to be decoded to start operation.
根据本发明的一实施范例,步骤S122可包括:计算压缩排区42内分别对应图场的图列数;以及依据图场次序以及图列数,将压缩排区42中的所有压缩比特流46解压缩回与此压缩排区42对应的影像排32中的所有图列34。According to an exemplary embodiment of the present invention, step S122 may include: calculating the number of columns corresponding to fields in the compressed arrangement area 42; All the image rows 34 in the image row 32 corresponding to the compressed row 42 are decompressed back.
根据本发明的另一实施范例,当每一个图列34是以多个压缩窗被压缩时,步骤S122可包括:依据图场次序以及图列数,将压缩比特流46中的子比特流解压缩回对应的压缩窗,作为与此压缩排区42对应的影像排32中的图列34。According to another embodiment of the present invention, when each picture sequence 34 is compressed with multiple compression windows, step S122 may include: decompressing the sub-bitstream in the compressed bitstream 46 according to the field order and the number of picture sequences Compress back to the corresponding compression window as the image row 34 in the image row 32 corresponding to the compressed row area 42 .
请参照图7B与图7C,其为根据本发明不同实施范例的影像解压缩的流程图。若解码器242将压缩比特流46都解压缩后发现有填充码48,可直接删除压缩排区42中的填充码48(步骤S124)。若填充码48是对应于此压缩排区42的验证码,则解码器242可以先依据此压缩排区42中的填充码48的验证码,验证此压缩排区42中的压缩比特流46是否正确(步骤S123),再删除填充码48。Please refer to FIG. 7B and FIG. 7C , which are flowcharts of image decompression according to different implementation examples of the present invention. If the decoder 242 finds the stuffing code 48 after decompressing the compressed bit stream 46, the stuffing code 48 in the compressed row area 42 can be directly deleted (step S124). If the padding code 48 is a verification code corresponding to the compressed queue area 42, the decoder 242 can first verify whether the compressed bit stream 46 in the compressed queued area 42 is If it is correct (step S123), then delete the filling code 48.
综上所述,编码器以压缩倍率压缩影像的原始数据,而能确保压缩得到的影像比特流省下足够的储存空间与记忆体存取频宽。通过预留压缩排区以及附加填充码的技术,编码器能够不论图场顺序而将对应于相同影像排的所有图列写在同一个压缩排区之中。在仅需要将整个影像中的任何一个影像排解压缩时,并不需要将整个影像比特流解压缩,而是只要将与所需的影像排对应的压缩排区解码即可。因此固定压缩倍率的影像压缩方法解决了现有技术中难以兼顾图场顺序以及影像排边界的问题。To sum up, the encoder compresses the original data of the image with a compression ratio, and can ensure that the compressed image bit stream saves enough storage space and memory access bandwidth. By reserving the compression row and adding padding codes, the encoder can write all the image sequences corresponding to the same image row into the same compression row regardless of the field order. When it is only necessary to decompress any image bank in the entire image, it is not necessary to decompress the entire image bit stream, but only need to decode the compressed bank area corresponding to the required image bank. Therefore, the image compression method with a fixed compression ratio solves the problem in the prior art that it is difficult to take into account the order of fields and the boundaries of image rows.
当然,本发明还可有其它多种实施例,在不背离本发明精神及其实质的情况下,熟悉本领域的技术人员当可根据本发明作出各种相应的改变和变形,但这些相应的改变和变形都应属于本发明所附的权利要求的保护范围。Certainly, the present invention also can have other multiple embodiments, without departing from the spirit and essence of the present invention, those skilled in the art can make various corresponding changes and deformations according to the present invention, but these corresponding Changes and deformations should belong to the scope of protection of the appended claims of the present invention.
Claims (11)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110195750.5A CN102868869B (en) | 2011-07-06 | 2011-07-06 | Image compression method and decompression method with fixed compression ratio and electronic device thereof |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201110195750.5A CN102868869B (en) | 2011-07-06 | 2011-07-06 | Image compression method and decompression method with fixed compression ratio and electronic device thereof |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102868869A CN102868869A (en) | 2013-01-09 |
CN102868869B true CN102868869B (en) | 2015-05-13 |
Family
ID=47447441
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201110195750.5A Expired - Fee Related CN102868869B (en) | 2011-07-06 | 2011-07-06 | Image compression method and decompression method with fixed compression ratio and electronic device thereof |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102868869B (en) |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101237582A (en) * | 2008-03-07 | 2008-08-06 | 北京中星微电子有限公司 | Local dynamic image amplification device and method and image processing system |
CN101472182A (en) * | 2007-12-19 | 2009-07-01 | 索尼株式会社 | Virtually lossless video data compression |
CN101702307A (en) * | 2009-11-17 | 2010-05-05 | 广东威创视讯科技股份有限公司 | Image importing device and display device and updating device of imported image |
-
2011
- 2011-07-06 CN CN201110195750.5A patent/CN102868869B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101472182A (en) * | 2007-12-19 | 2009-07-01 | 索尼株式会社 | Virtually lossless video data compression |
CN101237582A (en) * | 2008-03-07 | 2008-08-06 | 北京中星微电子有限公司 | Local dynamic image amplification device and method and image processing system |
CN101702307A (en) * | 2009-11-17 | 2010-05-05 | 广东威创视讯科技股份有限公司 | Image importing device and display device and updating device of imported image |
Also Published As
Publication number | Publication date |
---|---|
CN102868869A (en) | 2013-01-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN114556956B (en) | Low-latency encoding using bypassed and entropy coded substreams | |
US8879858B1 (en) | Multi-channel bit packing engine | |
US9510008B2 (en) | Video decoder memory bandwidth compression | |
US9460525B2 (en) | Tile-based compression and decompression for graphic applications | |
WO2021237510A1 (en) | Data decompression method and system, and processor and computer storage medium | |
CN110728725B (en) | Hardware-friendly real-time system-oriented lossless texture compression method | |
TWI545961B (en) | Image compression method, decompression method in static compression rate and electronic device thereof | |
US20180182127A1 (en) | Near lossless compression scheme and system for processing high dynamic range (hdr) images | |
TWI423682B (en) | Image processing method | |
CN106954075A (en) | Image processing apparatus and image compression method thereof | |
CN102868869B (en) | Image compression method and decompression method with fixed compression ratio and electronic device thereof | |
US20140185928A1 (en) | Hardware-supported huffman coding of images | |
WO2018068250A1 (en) | Method and device for data processing, chip and camera | |
CN110232657A (en) | A kind of image-scaling method, device, equipment and medium | |
CN109274955B (en) | Compression and synchronization method and system for light field video and depth map, and electronic equipment | |
EP1959350A2 (en) | Fusion memory device and method | |
US20120106861A1 (en) | Image compression method | |
TW201709735A (en) | Image processing system and image processing method | |
US20080091892A1 (en) | Interleaving memory read/write method and apparatus executing same | |
CN117640966A (en) | Image processing method, device, equipment and storage medium | |
CN117333559A (en) | Image compression method, device, electronic equipment and storage medium | |
CN102469306A (en) | Method for image compression | |
US20110286663A1 (en) | Method And Apparatus Of Color Image Rotation For Display And Recording Using JPEG | |
CN119213761A (en) | How to use the frame buffer during decoding | |
US20140300628A1 (en) | Tile-based compression and decompression for graphic applications |
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: 20150513 Termination date: 20190706 |
|
CF01 | Termination of patent right due to non-payment of annual fee |