[go: up one dir, main page]

CN107592541A - A kind of image decompression method and system - Google Patents

A kind of image decompression method and system Download PDF

Info

Publication number
CN107592541A
CN107592541A CN201710826772.4A CN201710826772A CN107592541A CN 107592541 A CN107592541 A CN 107592541A CN 201710826772 A CN201710826772 A CN 201710826772A CN 107592541 A CN107592541 A CN 107592541A
Authority
CN
China
Prior art keywords
data
image
row
frame
decompression
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
CN201710826772.4A
Other languages
Chinese (zh)
Other versions
CN107592541B (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.)
Institute of Semiconductors of CAS
Original Assignee
Institute of Semiconductors of CAS
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 Institute of Semiconductors of CAS filed Critical Institute of Semiconductors of CAS
Priority to CN201710826772.4A priority Critical patent/CN107592541B/en
Publication of CN107592541A publication Critical patent/CN107592541A/en
Application granted granted Critical
Publication of CN107592541B publication Critical patent/CN107592541B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

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

Abstract

本发明公开了一种针对特定图像压缩数据流的快速图像解压方法,详细说明了该方法所对应的压缩算法、解压缩实现流程,图像重建过程,内部结构及各模块间的互联关系,本发明还提出一种图像解压系统,可用于实现图像解压方法。本发明提供的图像解压缩方法和系统具有算法实现简单、意义明确,且可按照“图像行”展开进行多级流水操作,从而实现数据解压缩和图像无损重建。

The invention discloses a fast image decompression method for a specific image compressed data stream, and describes in detail the corresponding compression algorithm, decompression implementation process, image reconstruction process, internal structure and interconnection between modules. An image decompression system is also proposed, which can be used to implement the image decompression method. The image decompression method and system provided by the present invention have the advantages of simple algorithm implementation and clear meaning, and can perform multi-stage pipeline operations according to "image rows", thereby realizing data decompression and image lossless reconstruction.

Description

一种图像解压方法和系统Image decompression method and system

技术领域technical field

本发明涉及图像信息处理技术领域,特别是一种针对特定图像压缩数据流的解压缩方法和系统。The invention relates to the technical field of image information processing, in particular to a decompression method and system for a specific image compressed data stream.

背景技术Background technique

图像传感器目前已广泛应用于科学研究,工业生产,医疗卫生,国防军事等各个领域。随着图像分辨率及图像帧率的不断提升,人类得以观察到更加细微的物体特征,或者更为短暂的物理现象,从而极大的丰富了人类的观测手段,提高了人类的认知水平。Image sensors have been widely used in various fields such as scientific research, industrial production, medical and health care, national defense and military affairs. With the continuous improvement of image resolution and image frame rate, human beings can observe more subtle object features or more short-term physical phenomena, which greatly enriches human observation methods and improves human cognition.

但随着图像性能的迅速提升,同时也带来了图像数据量和数据传输带宽成倍增长的巨大挑战。海量的图像数据和超高数据传输带宽,为后续的图像传输、存储及处理都带来了一系列技术难题。为了解决上述问题,开发了一种实时处理高数据带宽的图像无损压缩方法,极大的降低了传输、存储的难度。与此同时,相应的解压缩方法也被提出,用于无损的重建图像,供后续研究和实际使用。However, with the rapid improvement of image performance, it also brings a huge challenge that the amount of image data and data transmission bandwidth increase exponentially. Massive image data and ultra-high data transmission bandwidth have brought a series of technical difficulties for subsequent image transmission, storage and processing. In order to solve the above problems, an image lossless compression method for real-time processing of high data bandwidth is developed, which greatly reduces the difficulty of transmission and storage. At the same time, corresponding decompression methods are also proposed for lossless reconstruction of images for subsequent research and practical use.

发明内容Contents of the invention

(一)要解决的技术问题(1) Technical problems to be solved

本发明的目的是针对一种高速、实时图像无损压缩算法,实现图像压缩算法的逆过程,即恢复压缩前的原始图像数据,无损的重建图像供后续使用,提出一种图像解压方法和系统。The purpose of the present invention is to aim at a high-speed, real-time image lossless compression algorithm, realize the inverse process of the image compression algorithm, that is, restore the original image data before compression, and reconstruct the image losslessly for subsequent use, and propose an image decompression method and system.

(二)技术方案(2) Technical solutions

一种图像解压缩方法,包括:S1:读取图像压缩数据流中的第一帧原始图像数据,并以第一帧原始图像数据作为基础图像数据;S2:读取并判断第i帧各行中每个图像行压缩数据是否在预先设定的阈值范围内,若图像行压缩数据位于阈值范围内,则将该图像行压缩数据与相同坐标的基础图像数据相加,若图像行压缩数据超出阈值范围,则读取与该超范围数据相对应的图像行非压缩数据,并将其与相同坐标的基础图像数据相加,计算得到第i帧的完整数据图像,并将其作为新的基础图像数据;S3:判断第i帧是否为最后一帧,若是,则完成图像解压缩,若否,则设定i=i+1,返回S2;其中,i为正整数,且其起始值为2。An image decompression method, comprising: S1: reading the first frame of original image data in the image compression data stream, and using the first frame of original image data as the basic image data; S2: reading and judging the i-th frame in each row Whether the compressed data of each image line is within the preset threshold range, if the compressed data of the image line is within the threshold range, add the compressed data of the image line to the basic image data of the same coordinates, if the compressed data of the image line exceeds the threshold range, then read the uncompressed data of the image row corresponding to the out-of-range data, add it to the basic image data of the same coordinates, calculate the complete data image of the i-th frame, and use it as a new basic image Data; S3: judge whether the i-th frame is the last frame, if so, complete the image decompression, if not, set i=i+1, and return to S2; wherein, i is a positive integer, and its initial value is 2.

优选地,步骤S2包括:S21:从基础图像数据中读取第j行的图像数据;S22:读取第i帧中第j行的第k个图像行压缩数据;S23:判断该图像行压缩数据是否在预先设定的阈值范围内,若是,则将该图像行压缩数据与相同坐标的基础图像数据相加,若否,则存储该图像行非压缩数据对应的坐标;S24:判断k的值是否为第j行包含的像素个数,若否,则设定k=k+1,返回S22处理第j行下一个图像行压缩数据,若是,则进入步骤S25;S25:逐个读取与所述存储坐标相对应的图像行非压缩数据,并将其与相同坐标的基础图像数据相加,得到第i帧第j行的图像数据,并用其更新基础图像数据的第j行;S26:判断j的值是否为第i帧图像包含的行数,若否,则设定j=i+1,返回S21处理另一行的图像行压缩数据,若是,则得到第i帧的完整数据图像,将其作为新的基础图像数据;其中,k和j均为正整数,且起始值均为1。Preferably, step S2 includes: S21: read the image data of the jth row from the basic image data; S22: read the compressed data of the kth image row of the jth row in the ith frame; S23: determine whether the image row is compressed Whether the data is within the preset threshold range, if so, add the compressed data of the image line to the basic image data of the same coordinates, if not, store the coordinates corresponding to the uncompressed data of the image line; S24: determine k Whether the value is the number of pixels included in the j row, if not, then set k=k+1, return to S22 to process the next image line compressed data of the j row, if so, then enter step S25; S25: read and The non-compressed data of the image line corresponding to the stored coordinates is added to the basic image data of the same coordinates to obtain the image data of the i-th frame and the j-th row, and use it to update the j-th row of the basic image data; S26: Determine whether the value of j is the number of rows that the i-th frame image contains, if not, then set j=i+1, return to S21 to process the image row compressed data of another row, if so, then obtain the complete data image of the i-th frame, Take it as the new basic image data; where, k and j are both positive integers, and the starting value is 1.

优选地,在S1和S2之间还包括S1A:扫描图像压缩数据流中预设的对齐编码,未发现预设的对齐编码时继续搜索,发现预设的对齐编码时进入步骤S2。Preferably, S1A is also included between S1 and S2: scan the preset alignment code in the compressed image data stream, continue searching if no preset alignment code is found, and enter step S2 if a preset alignment code is found.

一种图像解压缩系统,包括行解压缩处理模块,用于执行上述的图像解压缩方法,;An image decompression system, including a row decompression processing module, for performing the above-mentioned image decompression method;

优选地,还包括数据包帧头检测模块和图像帧数据缓存模块;所述数据包帧头检测模块用于扫描图像压缩数据流中预设的对齐编码,以触发行解压缩处理模块执行步骤S2;所述图像帧数据缓存模块用于缓存基础图像数据,所述基础图像数据为原始图像数据或第i帧的图像数据。Preferably, it also includes a data packet frame header detection module and an image frame data cache module; the data packet frame header detection module is used to scan the preset alignment code in the image compression data stream to trigger the line decompression processing module to perform step S2 ; The image frame data cache module is used to cache basic image data, the basic image data is the original image data or the image data of the i-th frame.

优选地,包括行解压缩处理模块,所述行解压缩处理模块包括数据流读取控制器、比较器、加法器、OV地址寄存器、图像行数据缓存和解压缩状态控制机;所述数据流读取控制器用于读取图像压缩数据流中的第一帧原始图像数据、图像行压缩数据和图像行非压缩数据,并将原始图像帧数据传输至图像行数据缓存,将图像行压缩数据发送至比较器和加法器,将图像行非压缩数据发送至加法器;所述图像行数据缓存用于接收原始图像数据,并将其写入图像帧数据缓存模块,并从图像帧数据缓存模块中读取基础图像数据中第j行的图像数据;所述比较器连接数据流读取控制器、加法器和OV地址寄存器,用于判断每个图像行压缩数据是否在预先设定的阈值范围内,若在,则发送触发信号至加法器,若不在,则将所述超阈值范围的数据对应的坐标存储至OV地址寄存器;所述解压缩状态控制机用于扫描OV地址寄存器中的地址,控制数据流读取控制器读取对应的图像行非压缩数据,并发送触发信号至加法器。所述加法器用于将图像行压缩数据与相同坐标的基础图像数据相加,以及将图像行非压缩数据与相同坐标的基础图像数据相加;所述图像行数据缓存还连接加法器,用于将第j行图像数据中所述相同坐标的基础图像数据传输至加法器进行计算,并从加法器获取更新后的第j行的图像数据,将其传回至图像帧数据缓存模块,更新基础图像数据的第j行。Preferably, a row decompression processing module is included, and the row decompression processing module includes a data stream reading controller, a comparator, an adder, an OV address register, an image row data cache, and a decompression state control machine; the data stream reading The acquisition controller is used to read the first frame of original image data, image line compressed data and image line uncompressed data in the image compressed data stream, and transmit the original image frame data to the image line data cache, and send the image line compressed data to The comparator and the adder send the uncompressed data of the image line to the adder; the image line data buffer is used to receive the original image data, and write it into the image frame data buffer module, and read it from the image frame data buffer module Get the image data of the jth row in the basic image data; the comparator is connected to the data flow reading controller, the adder and the OV address register, and is used to judge whether the compressed data of each image row is within a preset threshold range, If in, then send trigger signal to adder, if not in, then store the corresponding coordinate of the data of described ultra-threshold value range to OV address register; Described decompression state control machine is used for scanning the address in OV address register, control The data stream reading controller reads the uncompressed data of the corresponding image row, and sends a trigger signal to the adder. The adder is used to add the compressed data of the image line to the basic image data of the same coordinates, and to add the uncompressed data of the image line to the basic image data of the same coordinates; the image line data cache is also connected to the adder for Transmit the basic image data of the same coordinates in the jth row of image data to the adder for calculation, and obtain the updated image data of the jth row from the adder, and send it back to the image frame data buffer module to update the basic Row j of image data.

优选地,所述行解压缩处理模块还包括数据流写入控制器,所述数据流写入控制器位于图像行数据缓存和图像帧数据缓存模块之间,用于将图像数据在图像行数据缓存和图像帧数据缓存模块之间传输。Preferably, the line decompression processing module further includes a data stream writing controller, and the data stream writing controller is located between the image line data buffer and the image frame data buffer module, and is used to store the image data in the image line data Cache and image frame data are transferred between cache modules.

优选地,所述行解压缩处理模块还包括数据计数器和行计数器;所述数据计数器连接数据流读取控制器,用于记录数据流读取控制器读取的图像数据的个数,从而判断k的值是否为第j行包含的像素个数;所述行计数器连接数据流写入控制器,用于记录数据流写入控制器传输的数据的行数,从而判断j的值是否为第i帧图像包含的行数。Preferably, the row decompression processing module further includes a data counter and a row counter; the data counter is connected to the data stream reading controller, and is used to record the number of image data read by the data stream reading controller, thereby judging Whether the value of k is the number of pixels included in the jth row; the row counter is connected to the data stream writing controller, and is used to record the number of rows of data transmitted by the data stream writing controller, thereby judging whether the value of j is the first The number of lines contained in the i-frame image.

优选地,所述解压缩状态控制机还用于采集来自数据包帧头检测模块、数据计数器、OV地址寄存器、行计数器以及外部用户输入的信号,根据逻辑产生图像解压缩流程控制信号,按预定流程有序启/停数据流读取控制器、比较器、加法器、数据流写入控制器,以及产生解压缩数据流的同步有效信号。Preferably, the decompression state control machine is also used to collect signals from the data packet frame header detection module, data counter, OV address register, line counter and external user input, and generate image decompression process control signals according to the logic, according to the predetermined The process starts/stops the data stream reading controller, comparator, adder, data stream writing controller in an orderly manner, and generates a synchronous valid signal for decompressing the data stream.

优选地,还包括输入数据缓存模块和输出数据缓存模块;所述输入数据缓存模块用于缓存图像压缩数据流中的图像数据,并将数据传输至行解压缩处理模块;所述输出数据缓存模块连接行解压缩处理模块,用于缓存并输出第一帧原始图像数据以及后续每一帧图像数据。Preferably, it also includes an input data cache module and an output data cache module; the input data cache module is used to cache the image data in the image compression data stream, and transmits the data to the row decompression processing module; the output data cache module The row decompression processing module is connected, and is used for buffering and outputting the first frame of original image data and each subsequent frame of image data.

(三)有益效果(3) Beneficial effects

从上述技术方案中可以看出,本发明具有以下有益效果:As can be seen from the foregoing technical solutions, the present invention has the following beneficial effects:

(1)本发明方法层次简单,意义明确,实现容易,可以快速实现针对特定压缩数据流的图像无损恢复和重建;(1) The method of the present invention is simple in hierarchy, clear in meaning, easy to implement, and can quickly realize image lossless recovery and reconstruction for specific compressed data streams;

(2)本发明实际处理中按照“图像行”进行处理,利于复制多个相似的实现结构,展开进行多级流水操作,从而提高解压缩速度。(2) In the actual processing of the present invention, processing is carried out according to "image line", which is beneficial to duplicating multiple similar realization structures, unfolding and performing multi-stage pipeline operation, thereby increasing the decompression speed.

附图说明Description of drawings

图1为输入的图像压缩数据流示意图。Figure 1 is a schematic diagram of the input image compression data flow.

图2为本发明实施例的图像解压缩系统结构示意图。FIG. 2 is a schematic structural diagram of an image decompression system according to an embodiment of the present invention.

图3为本发明实施例的图像解压缩过程的状态机转移图。FIG. 3 is a state machine transition diagram of an image decompression process according to an embodiment of the present invention.

图4为本发明实施例的图像解压缩方法流程图。Fig. 4 is a flowchart of an image decompression method according to an embodiment of the present invention.

具体实施方式detailed description

为使本发明的目的、技术方案和优点更加清楚明白,以下结合具体实施例,并参照附图,对本发明作进一步的详细说明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.

本发明提出的图像解压缩方法,处理的图像压缩数据流,从数据结构上分为4个数据段,如图1所示为图像压缩数据流示意图,包括:In the image decompression method proposed by the present invention, the image compressed data stream processed is divided into 4 data segments from the data structure, as shown in Figure 1 is a schematic diagram of the image compressed data stream, including:

(1)原始图像帧数据段;(1) original image frame data segment;

(2)对齐编码数据段;(2) Align the encoded data segment;

(3)图像行压缩数据段;(3) image row compression data segment;

(4)图像行非压缩数据段。(4) The uncompressed data segment of the image row.

其中数据段(1)在整个压缩数据流中,仅出现一次;数据段(2)在一帧图像的压缩数据中,仅出现一次;数据段(3)、(4)则交替循环出现。且数据段(3)、(4)由公式(EQ1、EQ2、EQ3)产生,其中数据段(3)实际为B(p,l,f)计算结果,数据段(4)实际为O(p,l,f)计算结果:The data segment (1) only appears once in the entire compressed data stream; the data segment (2) only appears once in the compressed data of a frame of image; the data segments (3), (4) appear alternately and cyclically. And data segments (3), (4) are generated by formulas (EQ1, EQ2, EQ3), wherein data segment (3) is actually the calculation result of B(p, l, f), and data segment (4) is actually O(p , l, f) calculation result:

δ(p,l,f)=gray(p,l,f)-gray(p,l,f-1) (EQ1)δ(p,l,f)=gray(p,l,f)-gray(p,l,f-1) (EQ1)

(上式应满足1≤p≤M,Ldark+1<l≤N,f≥1,且TH=2K-1(0<K<R))(The above formula should satisfy 1≤p≤M, L dark +1<l≤N, f≥1, and TH=2 K -1 (0<K<R))

其中gray(p,l,f)为输入像素的灰度函数,p为像素序号,l为图像行序号,f为图像帧序号,M为图像宽度,N为图像高度,R为像素的量化位宽,Ldark为暗像素行行高。δ(p,l,f)表示残差,B(p,l,f)与O(p,l,f)分别代表残差编码标示值与溢出值,TH为预设阈值,binK(δ(p,l,f))与binK(TH)以及binK(-(TH+1))分别为残差的K比特有符号自然二进制码;TH的K比特有符号自然二进制码;-(TH+1)的K比特有符号自然二进制码;binR(δ(p,l,f))为残差的R比特有符号自然二进制码。Where gray(p, l, f) is the grayscale function of the input pixel, p is the pixel number, l is the image row number, f is the image frame number, M is the image width, N is the image height, and R is the quantization bit of the pixel Width, L dark is the row height of dark pixels. δ(p, l, f) represents the residual, B(p, l, f) and O(p, l, f) respectively represent the residual coding mark value and overflow value, TH is the preset threshold, binK (δ( p, l, f)) and binK (TH) and binK (-(TH+1)) are respectively the K-bit signed natural binary code of the residual; the K-bit signed natural binary code of TH; -(TH+1 ) is the K-bit signed natural binary code; binR (δ(p, l, f)) is the R-bit signed natural binary code of the residual.

本发明一实施例提供一种图像解压缩方法,包括以下步骤:An embodiment of the present invention provides an image decompression method, comprising the following steps:

S1:读取图像压缩数据流中的第一帧的原始图像数据,并以原始图像数据作为基础图像数据;S1: read the original image data of the first frame in the image compression data stream, and use the original image data as the basic image data;

S2:读取并判断第i帧各行中每个图像行压缩数据是否在预先设定的阈值范围内,若图像行压缩数据位于阈值范围内,则将该图像行压缩数据与相同坐标的基础图像数据相加,若图像行压缩数据超出阈值范围,则读取与该超范围数据相对应的图像行非压缩数据,并将其与相同坐标的基础图像数据相加,计算得到第i帧的完整数据图像,并将其作为新的基础图像数据;S2: Read and judge whether the compressed data of each image line in each line of the i-th frame is within the preset threshold range, and if the compressed image data is within the threshold range, compare the compressed data of the image line with the basic image with the same coordinates Data addition, if the image line compressed data exceeds the threshold range, read the image line uncompressed data corresponding to the over-range data, and add it to the basic image data of the same coordinates, and calculate the complete i-th frame data image, and use it as the new base image data;

S3:判断第i帧是否为最后一帧,若是,则完成图像解压缩,若否,则设定i=i+1,返回S2;其中,i的起始值为2。S3: Determine whether the i-th frame is the last frame, if yes, complete image decompression, if not, set i=i+1, and return to S2; wherein, the initial value of i is 2.

其中,步骤S2进一步包括:Wherein, step S2 further includes:

S21:从基础图像数据中读取第j行的图像数据;S21: Read the image data of row j from the basic image data;

S22:读取第i帧中第j行的第k个图像行压缩数据;S22: Read the compressed data of the k-th image row in the j-th row in the i-th frame;

S23:判断该图像行压缩数据是否在预先设定的阈值范围内,若是,则将该图像行压缩数据与相同坐标的基础图像数据(即第j行第k个基础图像数据)相加,若否,则存储该图像行非压缩数据对应的坐标;S23: judge whether the image line compressed data is within the preset threshold range, if so, add the image line compressed data to the basic image data of the same coordinates (i.e. the kth basic image data of the jth row), if If not, store the coordinates corresponding to the uncompressed data of the image row;

S24:判断k的值是否为第j行包含的像素个数,若否,则设定k=k+1,返回S22处理第j行下一个图像行压缩数据,若是,则进入步骤S25;S24: judge whether the value of k is the number of pixels contained in the j row, if not, then set k=k+1, return to S22 to process the compressed data of the next image line in the j row, if so, then enter step S25;

S25:逐个读取与所述存储坐标相对应的图像行非压缩数据,并将其与相同坐标的基础图像数据相加,得到第i帧第j行的图像数据,并用其更新基础图像数据的第j行;S25: Read the uncompressed data of the image row corresponding to the storage coordinates one by one, and add it to the basic image data of the same coordinates to obtain the image data of the jth row of the i-th frame, and use it to update the image data of the basic image data row j;

S26:判断j的值是否为第i帧图像包含的行数,若否,则设定j=j+1,返回S21处理另一行的图像行压缩数据,若是,则得到第i帧的完整数据图像,将其作为新的基础图像数据;其中,k和j均为正整数,且起始值均为1。S26: Determine whether the value of j is the number of lines contained in the image of the i-th frame, if not, set j=j+1, return to S21 to process the compressed data of the image line of another line, if so, obtain the complete data of the i-th frame image, which is used as the new basic image data; where k and j are both positive integers, and the initial value is 1.

在本发明一些实施例中,在S1和S2之间还包括S1A:扫描图像压缩数据流中预设的对齐编码,未发现预设的对齐编码时继续搜索,发现预设的对齐编码时进入步骤S2。In some embodiments of the present invention, S1A is also included between S1 and S2: scan the preset alignment code in the image compressed data stream, continue to search if no preset alignment code is found, and enter step when a preset alignment code is found S2.

本发明另一实施例提供一种图像解压缩系统,本发明的系统构成框图如图2所示,且针对上述数据结构,本发明按照图3所示状态机转移图有序工作。图像解压缩系统包括:SOF检测模块(数据包帧头检测模块)、输入数据缓存模块、行解压缩处理模块、图像帧数据缓存模块、输出数据缓存模块,且各模块间有序互联。其中,行解压缩处理模块用于执行步骤S1至S3。Another embodiment of the present invention provides an image decompression system. The system block diagram of the present invention is shown in FIG. 2 , and for the above data structure, the present invention works in an orderly manner according to the state machine transition diagram shown in FIG. 3 . The image decompression system includes: SOF detection module (data packet frame header detection module), input data cache module, row decompression processing module, image frame data cache module, output data cache module, and the modules are interconnected in an orderly manner. Wherein, the row decompression processing module is used to execute steps S1 to S3.

SOF检测模块(SOF是Start of Frame的缩写,表示数据包帧头)用于扫描图像压缩数据流中预设的对齐编码,从而在连续的图像压缩数据流中,快速定位到新一帧图像的起始位置,触发行解压缩处理模块执行步骤S2。The SOF detection module (SOF is the abbreviation of Start of Frame, indicating the packet frame header) is used to scan the preset alignment code in the image compression data stream, so as to quickly locate the new frame of image in the continuous image compression data stream The starting position triggers the row decompression processing module to execute step S2.

输入数据缓存模块用于缓存图像压缩数据流中的图像数据,并将数据传输至行解压缩处理模块。The input data buffering module is used for buffering the image data in the image compressed data stream, and transmitting the data to the row decompression processing module.

图像帧数据缓存模块用于缓存基础图像数据,所述基础图像数据为原始图像数据或第i帧的图像数据。图像帧数据缓存模块一方面接收缓存行解压缩处理模块的输出的图像数据,另一方面输出图像数据至行解压缩处理模块。其存储容量应满足至少能完整存储1帧图像数据。The image frame data cache module is used for caching basic image data, and the basic image data is original image data or image data of the i-th frame. The image frame data buffering module receives the image data output by the cache line decompression processing module on the one hand, and outputs the image data to the line decompression processing module on the other hand. Its storage capacity should be sufficient to completely store at least one frame of image data.

输出数据缓存模块连接行解压缩处理模块,用于缓存并输出行解压缩处理模块的输出的第一帧原始图像数据以及后续每一帧图像数据,即图像解压数据流。The output data cache module is connected to the row decompression processing module, and is used for buffering and outputting the first frame of original image data and each subsequent frame of image data output by the row decompression processing module, that is, the image decompression data stream.

行解压缩处理模块包括数据流读取控制器、解压缩控制状态机、数据计数器,比较器,OV地址寄存器,图像行数据缓存、加法器、行计数器和数据流写入控制器,且各个单元之间相互间有序互联。The line decompression processing module includes a data stream reading controller, a decompression control state machine, a data counter, a comparator, an OV address register, an image line data cache, an adder, a line counter and a data stream writing controller, and each unit interconnected in an orderly manner.

解压缩控制状态机连接行解压缩处理模块内的其他各单元,采集来自SOF检测模块、数据计数器、OV地址寄存器、行计数器以及外部用户输入信号(如阈值信息),根据逻辑产生图像解压缩流程控制信号,按预定流程有序启/停数据流读取控制器、比较器、加法器、数据流写入控制器,以及产生解压缩数据流的同步有效信号。The decompression control state machine is connected to other units in the row decompression processing module, collects signals from the SOF detection module, data counter, OV address register, row counter and external user input signals (such as threshold information), and generates an image decompression process according to the logic The control signal starts/stops the data stream reading controller, comparator, adder, data stream writing controller in an orderly manner according to a predetermined process, and generates a synchronous valid signal for decompressing the data stream.

数据流读取控制器连接解压缩状态控制机、图像行数据缓存、数据计数器、比较器和加法器,数据流读取控制器受到解压缩状态控制机输出脉冲的控制有序读取第一帧的原始图像帧数据、第i帧的图像行压缩数据和图像行非压缩数据,并将原始图像帧数据传输至图像行数据缓存、将图像行压缩数据发送至比较器和加法器,将图像行非压缩数据发送至加法器。The data flow reading controller is connected to the decompression state control machine, image line data cache, data counter, comparator and adder, and the data flow reading controller is controlled by the output pulse of the decompression state control machine to read the first frame in order The original image frame data, the image row compressed data and the image row uncompressed data of the i-th frame, and the original image frame data is transferred to the image row data cache, the image row compressed data is sent to the comparator and the adder, and the image row Uncompressed data is sent to the adder.

数据计数器连接解压缩状态控制机,用于记录数据流读取控制器读取数据的个数,以判断k的值是否为第j行包含的像素个数,即判断第k个图像行压缩数据是否为第j行最后一个数据;数据计数器为循环计数器,计数的最大范围至所解压图像单行所包含的像素个数(或像素点数)。当数据计数器计满了图像一行所需的像素个数后,产生脉冲信号并发送至解压缩状态控制机,使其控制各单元进行下一操作。数据计数器继而清零开始重新计数。The data counter is connected to the decompression state control machine, and is used to record the number of data read by the data stream reading controller, so as to judge whether the value of k is the number of pixels contained in the jth row, that is, judge the compressed data of the kth image row Whether it is the last data of line j; the data counter is a loop counter, and the maximum range of counting is the number of pixels (or number of pixels) contained in a single line of the decompressed image. When the data counter is full of the number of pixels required for one line of the image, a pulse signal is generated and sent to the decompression state control machine to control each unit to perform the next operation. The data counter is then cleared to zero and starts counting again.

图像行数据缓存连接解压缩状态控制机、数据流读取控制器和数据流写入控制器,用于缓存来自数据流读取控制器或数据流写入控制器的某一行图像数据。接收来自数据流读取控制器的原始图像数据,并将其写入图像帧数据缓存模块,并从图像帧数据缓存模块中读取基础图像数据中第j行的图像数据。图像行数据缓存还连接加法器,用于将第j行图像数据中所述相同坐标的基础图像数据传输至加法器进行计算,并从加法器获取更新后的第j行的图像数据,将其传回至图像帧数据缓存模块,更新基础图像数据的第j行。The image line data cache is connected to the decompression state control machine, the data stream read controller and the data stream write controller, and is used for buffering a certain line of image data from the data stream read controller or the data stream write controller. Receive the original image data from the data stream reading controller, write it into the image frame data buffer module, and read the image data of the jth row in the basic image data from the image frame data buffer module. The image row data cache is also connected to the adder, which is used to transmit the basic image data of the same coordinates in the jth row of image data to the adder for calculation, and obtain the updated image data of the jth row from the adder, and convert it to Send back to the image frame data cache module, and update the jth line of the basic image data.

数据流写入控制器连接解压缩状态控制机、图像行数据缓存、行计数器以及行解压缩处理模块外部的图像帧数据缓存模块和输出数据缓存模块。数据流写入控制器受到解压缩状态控制机输出脉冲的控制,将图像数据流在图像行数据缓存、图像帧数据缓存模块和输出数据缓存模块中有序搬移,且每完成1行操作即输出1次脉冲,从而启动行计数器加1。The data flow writing controller is connected with the decompression state control machine, the image row data buffer, the row counter, and the image frame data buffer module and the output data buffer module outside the row decompression processing module. The data flow writing controller is controlled by the output pulse of the decompression state control machine, and the image data flow is moved in an orderly manner in the image line data cache, image frame data cache module and output data cache module, and it is output every time a line operation is completed 1 pulse, which starts the row counter incremented by one.

比较器连接解压缩状态控制机、数据流读取控制器、加法器和OV地址寄存器,用于判断每个图像行压缩数据是否在预先设定的阈值范围内,接收解压缩状态控制机下发的阈值信息,将数据流读取控制器读入的图像行压缩数据与该阈值比较,如果在阈值表示范围内,则比较器向加法器发送触发信号,触发加法器读取数据并进行计算和输出;如在阈值范围外,则比较器将该超阈值范围的数据对应的坐标存储在OV地址寄存器里。The comparator is connected to the decompression state control machine, the data flow reading controller, the adder and the OV address register, and is used to judge whether the compressed data of each image row is within the preset threshold range, and receives the decompression state control machine to send The threshold information of the data flow reading controller is compared with the threshold value of the compressed image data read in by the data flow reading controller. If it is within the range indicated by the threshold value, the comparator sends a trigger signal to the adder, which triggers the adder to read the data and perform calculations. Output; if it is outside the threshold range, the comparator stores the coordinates corresponding to the data beyond the threshold range in the OV address register.

加法器连接解压缩状态控制机、数据流读取控制器、图像行数据缓存和比较器,受解压缩状态控制机的控制从图像行数据缓存读取相应坐标的数据,并将该数据与数据流读取控制器发送的相同坐标的图像行压缩数据或图像行非压缩数据求和。The adder is connected to the decompression state control machine, the data flow reading controller, the image line data cache and the comparator, and is controlled by the decompression state control machine to read the data of the corresponding coordinates from the image line data cache, and compare the data with the data The stream reads the sum of the image row compressed data or the image row uncompressed data sent by the same coordinates from the controller.

OV地址寄存器(OV是Overflow的缩写,表示溢出或超阈值),连接解压缩状态控制机和比较器,用于接收并存储比较器传输来的阈值范围外的像素点的位置信息。解压缩状态控制机扫描OV地址寄存器中的地址,控制数据流读取控制器读取对应的图像行非压缩数据,并发送触发信号至加法器。The OV address register (OV is the abbreviation of Overflow, which means overflow or over-threshold), connects the decompression state control machine and the comparator, and is used to receive and store the position information of pixels outside the threshold range transmitted by the comparator. The decompression state control machine scans the address in the OV address register, controls the data flow reading controller to read the corresponding uncompressed data of the image line, and sends a trigger signal to the adder.

行计数器连接解压缩状态控制机和数据流写入控制器,用于记录数据流写入控制器处理的数据的行数,以判断j的值是否为第i帧图像包含的行数,即判断第j行是否为第i帧图像的最后一行,行计数器为循环计数器,计数的最大范围至所解压图像帧的高度(或最大图像行数),计满后产生脉冲信号,并将脉冲信号发送至解压缩状态控制机,使其控制各单元进行下一操作。行计数器继而清零并重新计数。The line counter is connected to the decompression state control machine and the data stream writing controller, and is used to record the number of lines of data processed by the data stream writing controller, so as to judge whether the value of j is the number of lines contained in the i-th frame image, that is, judge Whether the jth line is the last line of the i-th frame image, the line counter is a loop counter, the maximum range of counting is to the height of the decompressed image frame (or the maximum number of image lines), a pulse signal is generated after the count is full, and the pulse signal is sent To uncompress the state control machine, make it control each unit to carry out the next operation. The row counter is then cleared and restarted.

本发明另一实施例提供一种图像解压缩方法,用于图像解压缩系统,图像解压缩的实现步骤在5个状态中进行有序、有条件转换,如图3为本发明实施例的图像解压缩方法流程图,图4为本发明实施例的图像解压缩过程的状态机转移图,包括以下步骤:Another embodiment of the present invention provides an image decompression method, which is used in an image decompression system. The implementation steps of image decompression are sequentially and conditionally converted in five states, as shown in Figure 3 for the image of the embodiment of the present invention Decompression method flow chart, Fig. 4 is the state machine transfer diagram of the image decompression process of the embodiment of the present invention, comprises the following steps:

步骤S1:读取图像压缩数据流中的第一帧原始图像数据,并以第一帧原始图像数据作为基础图像数据。Step S1: Read the first frame of original image data in the image compression data stream, and use the first frame of original image data as the basic image data.

在本实施例中,图像解压缩系统为上述的图像解压缩系统。行解压缩处理模块读取压缩数据流中的原始图像帧数据,并将完整的原始图像帧数据写入图像帧数据缓存模块,并将图像帧数据缓存模块存储的第一帧原始图像数据作为基础图像数据。In this embodiment, the image decompression system is the above-mentioned image decompression system. The line decompression processing module reads the original image frame data in the compressed data stream, and writes the complete original image frame data into the image frame data cache module, and uses the first frame of original image data stored in the image frame data cache module as the basis image data.

该步骤中图像解压缩过程处于状态1,该状态针对(1)数据段进行,包括以下子步骤:Image decompression process is in state 1 in this step, and this state is carried out for (1) data segment, comprises the following substeps:

子步骤S11:解压缩状态控制机启动数据流读取控制器、数据计数器,将读取的数据顺序写入图像行数据缓存。当数据计数器计满了图像一行所需的像素个数后,解压缩状态机停止数据流读取控制器,并启动数据流写入控制器;Sub-step S11: the decompression state control machine activates the data flow reading controller and the data counter, and sequentially writes the read data into the image line data cache. When the data counter is full of the number of pixels required for one line of the image, the decompression state machine stops the data flow reading controller, and starts the data flow writing controller;

子步骤S12:数据流写入控制器将图像行数据缓存中的数据同时搬入图像帧缓存模块和输出数据缓存模块,当写入控制器操作完毕时产生一个脉冲,启动行计数器加1,标示1行数据处理完成。Sub-step S12: The data flow writing controller moves the data in the image line data buffer into the image frame buffer module and the output data buffer module at the same time, when the write controller operation is completed, a pulse is generated, and the start line counter is incremented by 1, marking 1 Row data processing is complete.

子步骤S13:重复子步骤S11和S12,直到行计数器计满一帧图像的全部行数。Sub-step S13: Repeat sub-steps S11 and S12 until the line counter counts all the lines of a frame of image.

完成该状态操作时,图像帧数据缓存模块中已保存了完整1帧原始图像,而输出端也输出了完整的一帧图像数据。此后,解压缩状态控制机转入下一个状态。When this state operation is completed, a complete frame of original image has been saved in the image frame data buffer module, and a complete frame of image data is also output from the output terminal. Thereafter, the decompression state control machine goes to the next state.

步骤S1A:扫描图像压缩数据流中预设的对齐编码,未发现预设的对齐编码时继续搜索,发现预设的对齐编码时进入步骤S2。Step S1A: Scan the preset alignment code in the compressed image data stream, continue searching if no preset alignment code is found, and proceed to step S2 if a preset alignment code is found.

该步骤中图像解压缩过程处于状态2,状态2针对数据段(2),使用SOF检索模块对输入数据流进行扫描,未发现预设的对齐编码时则继续搜索;若发现事先设定的对齐码则产生触发脉冲,启动解压缩状态控制机,开始进入图像行解压模式;(此处对齐码为事先设定值或约定值,例如:一行像素值全部为0xFFFF,下一行像素值全为0x0000,诸如此类连续相邻两行之间灰度值巨大突变的数据。)In this step, the image decompression process is in state 2. In state 2, for the data segment (2), use the SOF retrieval module to scan the input data stream, and continue searching if no preset alignment code is found; if a preset alignment is found The code generates a trigger pulse, starts the decompression state control machine, and starts to enter the image line decompression mode; (here, the alignment code is a preset value or an agreed value, for example: the pixel values of one line are all 0xFFFF, and the pixel values of the next line are all 0x0000 , such as data with a huge mutation in the gray value between two consecutive adjacent rows.)

步骤S2:读取并判断第i帧各行中每个图像行压缩数据是否在预先设定的阈值范围内,若图像行压缩数据位于阈值范围内,则将该图像行压缩数据与相同坐标的基础图像数据相加,若图像行压缩数据超出阈值范围,则读取与该超范围数据相对应的图像行非压缩数据,并将其与相同坐标的基础图像数据相加,计算得到第i帧的完整数据图像,并将其作为新的基础图像数据。Step S2: Read and judge whether the compressed data of each image row in each row of the i-th frame is within the preset threshold range, and if the compressed image data is within the threshold range, then compare the compressed data of the image row with the basis of the same coordinates Add the image data, if the image line compressed data exceeds the threshold range, read the image line uncompressed data corresponding to the over-range data, and add it to the basic image data with the same coordinates, and calculate the i-th frame Complete the data image and use it as the new base image data.

其中,i为正整数,且其起始值为2。步骤S2包括以下子步骤:Among them, i is a positive integer, and its initial value is 2. Step S2 includes the following sub-steps:

子步骤S21:从基础图像数据中读取第j行的图像数据。Sub-step S21: read the jth line of image data from the basic image data.

其中,j为正整数,且其起始值为1。解压缩状态控制机启动数据流写入控制器,从图像帧数据缓存模块中读出一行(第j行)基础图像数据至图像行数据缓存;Wherein, j is a positive integer, and its initial value is 1. The decompression state control machine starts the data stream writing controller, and reads out one row (the jth row) basic image data to the image row data cache from the image frame data cache module;

子步骤S22:读取第i帧中第j行的第k个图像行压缩数据。Sub-step S22: Read the compressed data of the k-th image line in the j-th line in the i-th frame.

其中,k为正整数,且其起始值为1。Wherein, k is a positive integer, and its initial value is 1.

该步骤中图像解压缩过程处于状态3,状态3针对(3)数据段,解压缩状态控制机启动数据流读取控制器、计数器和比较器,数据流读取控制器依次读取压缩数据流中的图像行压缩数据,并将当前读入的数据(如第j行的第k个图像行压缩数据)传输至比较器和加法器。In this step, the image decompression process is in state 3, and state 3 is for (3) data segment, and the decompression state control machine starts the data stream reading controller, counter and comparator, and the data stream reading controller reads the compressed data stream successively The image row compressed data in the image row, and the currently read-in data (such as the k-th image row compressed data of the j-th row) is transmitted to the comparator and the adder.

子步骤S23:判断该图像行压缩数据是否在预先设定的阈值范围内,若是,则将该图像行压缩数据与相同坐标的基础图像数据相加,若否,则存储该图像行非压缩数据对应的坐标。Sub-step S23: judge whether the image line compressed data is within the preset threshold range, if yes, add the image line compressed data to the basic image data of the same coordinates, if not, store the image line uncompressed data corresponding coordinates.

在比较器内将当前读入的数据与预先设定的阈值进行比较判断,如当前读入的数据在阈值表示范围内,则比较器触发加法器,加法器从图像行数据缓存中取出与当前读入的图像行压缩数据相同坐标地址的数据并将其与当前读入的图像行压缩数据求和,再将计算结果写入图像行数据缓存,更新图像行数据缓存的图像行数据。如果在阈值表示范围以外,则比较器触发OV地址寄存器,将当前读取的像素数据的坐标地址写入该OV地址寄存器。In the comparator, compare and judge the currently read-in data with the preset threshold value. If the currently read-in data is within the range indicated by the threshold value, the comparator will trigger the adder, and the adder will fetch the data from the image line data cache and the current Read the data of the same coordinate address of the image line compressed data and sum it with the currently read image line compressed data, then write the calculation result into the image line data cache, and update the image line data in the image line data cache. If it is outside the range indicated by the threshold, the comparator triggers the OV address register, and writes the coordinate address of the currently read pixel data into the OV address register.

此步骤实现了δ(p,l,f)=gray(p,l,f)-gray(p,l,f-1)中一种情况的逆过程(即,当前行像素值与相邻上一帧图像中同位置行对应像素值的差异,在设定的阈值范围以内的情况),即根据读入数据B(p,l,f)和图像行数据缓存中的gray(p,l,f一1),求解得到gray(p,l,f)。如果在阈值表示范围以外,则触发OV地址寄存器,将当前像素地址写入该寄存器,等待下一步操作。This step realizes the inverse process of a case in δ(p, l, f)=gray(p, l, f)-gray(p, l, f-1) (that is, the pixel value of the current row and the adjacent upper The difference of pixel values corresponding to the same position line in a frame of image is within the set threshold range), that is, according to the read-in data B(p, l, f) and gray (p, l, f) in the image line data cache f-1), solve to get gray(p, l, f). If it is outside the range indicated by the threshold, trigger the OV address register, write the current pixel address into this register, and wait for the next operation.

子步骤S24:判断k的值是否为第j行包含的像素个数,若否,则设定k=k+1,返回S22处理第j行下一个图像行压缩数据,若是,则进入步骤S25。Sub-step S24: judge whether the value of k is the number of pixels contained in the jth row, if not, then set k=k+1, return to S22 to process the compressed data of the next image row in the jth row, if so, then enter step S25 .

在上述过程中,数据计数器记录数据流读取控制器读取的图像行压缩数据的个数,即判断了k的值是否达到第j行包含的像素个数,当数据计数器计满了图像一行所需的像素个数后,第k个图像行压缩数据为第j行的最后一个图像行压缩数据,转入下一个状态。In the above process, the data counter records the number of image line compressed data read by the data stream reading controller, that is, it is judged whether the value of k reaches the number of pixels contained in the jth line, when the data counter is full of the image line After the required number of pixels, the compressed data of the k-th image line is the compressed data of the last image line of the j-th line, and the state is transferred to the next state.

子步骤S25:逐个读取与所述存储坐标相对应的图像行非压缩数据,并将其与相同坐标的基础图像数据相加,得到第i帧第j行的图像数据,并用其更新基础图像数据的第j行。Sub-step S25: Read the uncompressed data of the image row corresponding to the storage coordinates one by one, and add it to the basic image data of the same coordinates to obtain the image data of the jth row of the i-th frame, and use it to update the basic image The jth row of the data.

该步骤中图像解压缩过程处于状态4,状态4针对(4)数据段,解压缩状态控制机逐个扫描OV地址寄存器中记录的地址数据,解压缩状态控制机触发加法器从图像行数据缓存中取出相同坐标地址的数据,并将此时数据流读取控制器获得的数据,与图像行数据缓存相同地址读出的数据交由加法器计算,再将计算结果写回到图像行数据缓存相应的坐标地址内。启动数据流写入控制器,将图像行数据缓存中的数据搬入到图像帧数据缓存模块和输出数据缓存模块。此时,实际完成了图像帧数据缓存模块中新图像行的刷新,以及新图像行的输出。数据流写入控制器输出完毕的同时产生一个脉冲,启动行计数器加1,标示一行数据处理完成。In this step, the image decompression process is in state 4, and state 4 is for (4) data segment, and the decompression state control machine scans the address data recorded in the OV address register one by one, and the decompression state control machine triggers the adder from the image row data cache Take out the data at the same coordinate address, and read the data obtained by the data flow controller at this time, and send the data read from the same address as the image line data cache to the adder for calculation, and then write the calculation result back to the corresponding image line data cache within the coordinate address of . Start the data flow writing controller, and move the data in the image row data buffer to the image frame data buffer module and the output data buffer module. At this point, the refreshing of the new image line in the image frame data buffer module and the output of the new image line are actually completed. When the data flow is written into the controller and the output is completed, a pulse is generated at the same time, and the start line counter is increased by 1, indicating that the data processing of one line is completed.

此步骤实现了δ(p,l,f)=gray(p,l,f)-gray(p,l,f-1)中另一种情况的逆过程(即,当前行像素值与相邻上一帧图像中同样位置行对应像素值的差异,在设定的阈值范围以外的情况),即根据读入数据O(p,l,f)和图像行数据缓存中的gray(p,l,f-1)求得了gray(p,l,f)。当扫描完OV地址寄存器,解压缩状态机This step realizes the inverse process of another case in δ(p, l, f)=gray(p, l, f)-gray(p, l, f-1) (that is, the pixel value of the current row is the same as that of the adjacent The difference of the corresponding pixel value of the same position row in the previous frame of image, in the case outside the set threshold range), that is, according to the read data O(p, l, f) and the gray (p, l , f-1) to obtain gray (p, l, f). When the OV address register is scanned, the decompression state machine

子步骤S26:判断j的值是否为第i帧图像包含的行数,若否,则设定j=j+1,返回S21处理另一行的图像行压缩数据,若是,则得到第i帧的完整数据图像,将其作为新的基础图像数据;Sub-step S26: judge whether the value of j is the number of lines contained in the i-th frame image, if not, then set j=j+1, return to S21 to process another line of image line compressed data, if so, then obtain the i-th frame The complete data image as the new base image data;

上述过程中,行计数器记录了图像帧数据缓存模块中刷新的图像数据的行数,即判断了j的值是否为第i帧图像包含的行数,第j行是否为该帧图像最后一行,若没有完成所有行的刷新,则设定j=j+1,返回S21处理另一行的图像行压缩数据,数据流写入控制器从图像帧数据缓存模块读出下一行图像数据缓存至图像行数据缓存,解压缩状态控制器控制数据流读取控制器、比较器、加法器、OV地址寄存器、数据计数器和行计数器处理下一行图像数据,并将处理完成的下一行图像搬入到图像帧数据缓存模块和输出数据缓存模块,完成下一行图像的刷新和输出,直至解压缩状态机扫描行计数器达到图像高度(或图像行数),则此时图像帧缓存模块中保存了完整的第i帧图像数据,而输出端也输出了完整的第i帧图像数据,将其作为新的基础图像数据。In the above process, the line counter records the number of lines of the image data refreshed in the image frame data buffer module, that is, it is judged whether the value of j is the number of lines contained in the i-th frame image, whether the j-th line is the last line of the frame image, If the refreshing of all rows has not been completed, then set j=j+1, return to S21 to process the image row compressed data of another row, and the data flow writing controller reads the next row of image data from the image frame data cache module and caches it to the image row Data cache, decompression state controller controls data flow read controller, comparator, adder, OV address register, data counter and line counter process the next line of image data, and move the processed next line of image into the image frame data The cache module and the output data cache module complete the refresh and output of the next row of images until the decompression state machine scan line counter reaches the image height (or image row number), then the complete i-th frame is preserved in the image frame buffer module at this time image data, and the output end also outputs the complete i-th frame image data, which is used as the new basic image data.

步骤S3:判断第i帧是否为最后一帧,若是,则完成图像解压缩,若否,则设定i=i+1,返回S2。Step S3: Determine whether the i-th frame is the last frame, if yes, complete image decompression, if not, set i=i+1, and return to S2.

判断第i帧是否为最后一帧(这个判断过程可以由解压缩状态控制机或数据流读取控制器完成)若是,则完成所有图像帧的解压缩,若否,则设定i=i+1,返回步骤S1A重新检索下一帧图像。该步骤中图像解压缩处于状态5,重复步骤S1A至S3,直至处理完成所有F帧图像的解压。Judging whether the i-th frame is the last frame (this judging process can be completed by the decompression state control machine or the data stream reading controller) if so, then complete the decompression of all image frames, if not, then set i=i+ 1. Return to step S1A to re-retrieve the next frame of image. In this step, image decompression is in state 5, and steps S1A to S3 are repeated until the decompression of all F frames of images is completed.

还需要说明的是,实施例中提到的方向用语,例如“上”、“下”、“前”、“后”、“左”、“右”等,仅是参考附图的方向,并非用来限制本发明的保护范围。贯穿附图,相同的元素由相同或相近的附图标记来表示。在可能导致对本发明的理解造成混淆时,将省略常规结构或构造。It should also be noted that the directional terms mentioned in the embodiments, such as "up", "down", "front", "back", "left", "right", etc., are only referring to the directions of the drawings, not Used to limit the protection scope of the present invention. Throughout the drawings, the same elements are indicated by the same or similar reference numerals. Conventional structures or constructions will be omitted when they may obscure the understanding of the present invention.

并且图中各部件的形状和尺寸不反映真实大小和比例,而仅示意本发明实施例的内容。另外,在权利要求中,不应将位于括号之间的任何参考符号构造成对权利要求的限制。And the shape and size of each component in the figure do not reflect the actual size and proportion, but only illustrate the content of the embodiment of the present invention. Furthermore, in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim.

除非有所知名为相反之意,本说明书及所附权利要求中的数值参数是近似值,能够根据通过本发明的内容所得的所需特性改变。具体而言,所有使用于说明书及权利要求中表示组成的含量、反应条件等等的数字,应理解为在所有情况中是受到「约」的用语所修饰。一般情况下,其表达的含义是指包含由特定数量在一些实施例中±10%的变化、在一些实施例中±5%的变化、在一些实施例中±1%的变化、在一些实施例中±0.5%的变化。Unless known to the contrary, the numerical parameters set forth in the specification and appended claims are approximations that can vary depending upon the desired properties obtained through the teachings of the invention. Specifically, all numbers used in the specification and claims to represent the content of components, reaction conditions, etc. should be understood to be modified by the term "about" in all cases. In general, the expressed meaning is meant to include a variation of ±10% in some embodiments, a variation of ±5% in some embodiments, a variation of ±1% in some embodiments, a variation of ±1% in some embodiments, and a variation of ±1% in some embodiments ±0.5% variation in the example.

再者,单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。Furthermore, the word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements.

此外,除非特别描述或必须依序发生的步骤,上述步骤的顺序并无限制于以上所列,且可根据所需设计而变化或重新安排。并且上述实施例可基于设计及可靠度的考虑,彼此混合搭配使用或与其他实施例混合搭配使用,即不同实施例中的技术特征可以自由组合形成更多的实施例。In addition, unless specifically described or steps that must occur sequentially, the order of the above steps is not limited to that listed above and may be changed or rearranged according to the desired design. Moreover, the above-mentioned embodiments can be mixed and matched with each other or used with other embodiments based on design and reliability considerations, that is, technical features in different embodiments can be freely combined to form more embodiments.

类似地,应当理解,为了精简本发明并帮助理解各个发明方面中的一个或多个,在上面对本发明的示例性实施例的描述中,本发明的各个特征有时被一起分组到单个实施例、图、或者对其的描述中。然而,并不应将该发明的方法解释成反映如下意图:即所要求保护的本发明要求比在每个权利要求中所明确记载的特征更多的特征。更确切地说,如下面的权利要求书所反映的那样,发明方面在于少于前面发明的单个实施例的所有特征。因此,遵循具体实施方式的权利要求书由此明确地并入该具体实施方式,其中每个权利要求本身都作为本发明的单独实施例。Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, in order to streamline the present disclosure and to facilitate an understanding of one or more of the various inventive aspects, various features of the invention are sometimes grouped together in a single embodiment, figure, or its description. This method of invention, however, is not to be interpreted as reflecting an intention that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing invention. Thus, the claims following the Detailed Description are hereby expressly incorporated into this Detailed Description, with each claim standing on its own as a separate embodiment of this invention.

以上所述的具体实施例,对本发明的目的、技术方案和有益效果进行了进一步详细说明,应理解的是,以上所述仅为本发明的具体实施例而已,并不用于限制本发明,凡在本发明的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The specific embodiments described above have further described the purpose, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above descriptions are only specific embodiments of the present invention, and are not intended to limit the present invention. Within the spirit and principles of the present invention, any modifications, equivalent replacements, improvements, etc., shall be included in the protection scope of the present invention.

Claims (10)

1.一种图像解压缩方法,包括:1. An image decompression method, comprising: S1:读取图像压缩数据流中的第一帧的原始图像数据,并以原始图像数据作为基础图像数据;S1: read the original image data of the first frame in the image compression data stream, and use the original image data as the basic image data; S2:读取并判断第i帧各行中每个图像行压缩数据是否在预先设定的阈值范围内,若图像行压缩数据位于阈值范围内,则将该图像行压缩数据与相同坐标的基础图像数据相加,若图像行压缩数据超出阈值范围,则读取与该超范围数据相对应的图像行非压缩数据,并将其与相同坐标的基础图像数据相加,计算得到第i帧的完整数据图像,并将其作为新的基础图像数据;S2: Read and judge whether the compressed data of each image line in each line of the i-th frame is within the preset threshold range, and if the compressed image data is within the threshold range, compare the compressed data of the image line with the basic image with the same coordinates Data addition, if the image line compressed data exceeds the threshold range, read the image line uncompressed data corresponding to the over-range data, and add it to the basic image data of the same coordinates, and calculate the complete i-th frame data image, and use it as the new base image data; S3:判断第i帧是否为最后一帧,若是,则完成图像解压缩,若否,则设定i=i+1,返回S2;S3: judge whether the i-th frame is the last frame, if so, complete the image decompression, if not, set i=i+1, and return to S2; 其中,i的起始值为2。Among them, the initial value of i is 2. 2.根据权利要求1所述的图像解压缩方法,其中,步骤S2进一步包括:2. The image decompression method according to claim 1, wherein, step S2 further comprises: S21:从基础图像数据中读取第j行的图像数据;S21: Read the image data of row j from the basic image data; S22:读取第i帧中第j行的第k个图像行压缩数据;S22: Read the compressed data of the k-th image row in the j-th row in the i-th frame; S23:判断该图像行压缩数据是否在预先设定的阈值范围内,若是,则将该图像行压缩数据与相同坐标的基础图像数据相加,若否,则存储该图像行非压缩数据对应的坐标;S23: Determine whether the image row compressed data is within the preset threshold range, if so, add the image row compressed data to the basic image data at the same coordinates, if not, store the image row corresponding to the uncompressed data coordinate; S24:判断k的值是否为第j行包含的像素个数,若否,则设定k=k+1,返回S22处理第j行下一个图像行压缩数据,若是,则进入步骤S25;S24: judge whether the value of k is the number of pixels contained in the j row, if not, then set k=k+1, return to S22 to process the compressed data of the next image line in the j row, if so, then enter step S25; S25:逐个读取与所述存储坐标相对应的图像行非压缩数据,并将其与相同坐标的基础图像数据相加,得到第i帧第j行的图像数据,并用其更新基础图像数据的第j行;S25: Read the uncompressed data of the image row corresponding to the storage coordinates one by one, and add it to the basic image data of the same coordinates to obtain the image data of the jth row of the i-th frame, and use it to update the image data of the basic image data row j; S26:判断j的值是否为第i帧图像包含的行数,若否,则设定j=j+1,返回S21处理另一行的图像行压缩数据,若是,则得到第i帧的完整数据图像,将其作为新的基础图像数据;S26: Determine whether the value of j is the number of lines contained in the image of the i-th frame, if not, set j=j+1, return to S21 to process the compressed data of the image line of another line, if so, obtain the complete data of the i-th frame image as the new base image data; 其中,k和j均为正整数,且起始值均为1。Wherein, both k and j are positive integers, and the initial value is 1. 3.根据权利要求1或2所述的图像解压缩方法,其中,在S1和S2之间还包括S1A:扫描图像压缩数据流中预设的对齐编码,未发现预设的对齐编码时继续搜索,发现预设的对齐编码时进入步骤S2。3. The image decompression method according to claim 1 or 2, wherein, between S1 and S2, S1A is also included: scanning the preset alignment coding in the image compression data stream, and continuing to search when no preset alignment coding is found , enter step S2 when a preset alignment code is found. 4.一种图像解压缩系统,包括行解压缩处理模块,用于执行如权利要求1至3中任一项所述的图像解压缩方法。4. An image decompression system, comprising a line decompression processing module for executing the image decompression method according to any one of claims 1 to 3. 5.根据权利要求4所述的图像解压缩系统,其中,还包括数据包帧头检测模块和图像帧数据缓存模块;5. The image decompression system according to claim 4, wherein, also comprising a data packet frame header detection module and an image frame data cache module; 所述数据包帧头检测模块用于扫描图像压缩数据流中预设的对齐编码,以触发行解压缩处理模块执行步骤S2;The data packet frame header detection module is used to scan the preset alignment coding in the image compressed data stream, so as to trigger the line decompression processing module to perform step S2; 所述图像帧数据缓存模块用于缓存基础图像数据,所述基础图像数据为原始图像数据或第i帧的图像数据。The image frame data caching module is used for caching basic image data, and the basic image data is original image data or image data of the i-th frame. 6.根据权利要求5所述的图像解压缩系统,其中,所述行解压缩处理模块包括数据流读取控制器、比较器、加法器、OV地址寄存器、图像行数据缓存和解压缩状态控制机;6. The image decompression system according to claim 5, wherein the row decompression processing module comprises a data flow read controller, a comparator, an adder, an OV address register, an image row data cache and a decompression state control machine ; 所述数据流读取控制器用于读取图像压缩数据流中的第一帧原始图像数据、图像行压缩数据和图像行非压缩数据,并将原始图像帧数据传输至图像行数据缓存,将图像行压缩数据发送至比较器和加法器,将图像行非压缩数据发送至加法器;The data stream reading controller is used to read the first frame of original image data, image line compressed data and image line uncompressed data in the image compression data stream, and transmit the original image frame data to the image line data cache, and image The row compressed data is sent to the comparator and the adder, and the image row uncompressed data is sent to the adder; 所述图像行数据缓存用于接收原始图像数据,并将其写入图像帧数据缓存模块,并从图像帧数据缓存模块中读取基础图像数据中第j行的图像数据;The image row data buffer is used to receive the original image data, and write it into the image frame data buffer module, and read the image data of the jth row in the basic image data from the image frame data buffer module; 所述比较器连接数据流读取控制器、加法器和OV地址寄存器,用于判断每个图像行压缩数据是否在预先设定的阈值范围内,若在,则发送触发信号至加法器,若不在,则将所述超阈值范围的数据对应的坐标存储至OV地址寄存器;The comparator is connected to the data flow reading controller, the adder and the OV address register, and is used to judge whether the compressed data of each image line is within the preset threshold range, if so, then send a trigger signal to the adder, if If not, the coordinates corresponding to the data in the super-threshold range are stored in the OV address register; 所述解压缩状态控制机用于扫描OV地址寄存器中的地址,控制数据流读取控制器读取对应的图像行非压缩数据,并发送触发信号至加法器。The decompression state control machine is used to scan the address in the OV address register, control the data flow reading controller to read the corresponding uncompressed data of the image row, and send a trigger signal to the adder. 所述加法器用于将图像行压缩数据与相同坐标的基础图像数据相加,以及将图像行非压缩数据与相同坐标的基础图像数据相加;The adder is used to add the compressed data of the image row to the basic image data of the same coordinates, and to add the uncompressed data of the image row to the basic image data of the same coordinates; 所述图像行数据缓存还连接加法器,用于将第j行图像数据中所述相同坐标的基础图像数据传输至加法器进行计算,并从加法器获取更新后的第j行的图像数据,将其传回至图像帧数据缓存模块,更新基础图像数据的第j行。The image row data buffer is also connected to an adder, which is used to transmit the basic image data of the same coordinates in the jth row of image data to the adder for calculation, and obtain the updated image data of the jth row from the adder, Pass it back to the image frame data cache module, and update the jth line of the basic image data. 7.根据权利要求6所述的图像解压缩系统,其中,所述行解压缩处理模块还包括数据流写入控制器,所述数据流写入控制器位于图像行数据缓存和图像帧数据缓存模块之间,用于将图像数据在图像行数据缓存和图像帧数据缓存模块之间传输。7. The image decompression system according to claim 6, wherein the row decompression processing module further comprises a data stream writing controller, and the data stream writing controller is located at the image line data cache and the image frame data cache Between modules, it is used to transfer image data between image line data cache and image frame data cache modules. 8.根据权利要求7所述的图像解压缩系统,其中,所述行解压缩处理模块还包括数据计数器和行计数器;8. The image decompression system according to claim 7, wherein the row decompression processing module further comprises a data counter and a row counter; 所述数据计数器连接数据流读取控制器,用于记录数据流读取控制器读取的图像数据的个数,从而判断k的值是否为第j行包含的像素个数;The data counter is connected to the data flow reading controller, and is used to record the number of image data read by the data flow reading controller, thereby judging whether the value of k is the number of pixels included in the j row; 所述行计数器连接数据流写入控制器,用于记录数据流写入控制器传输的数据的行数,从而判断j的值是否为第i帧图像包含的行数。The line counter is connected to the data stream writing controller, and is used to record the number of lines of data transmitted by the data stream writing controller, so as to determine whether the value of j is the number of lines contained in the i-th frame image. 9.根据权利要求8所述的图像解压缩系统,其中,所述解压缩状态控制机还用于采集来自数据包帧头检测模块、数据计数器、OV地址寄存器、行计数器以及外部用户输入的信号,根据逻辑产生图像解压缩流程控制信号,按预定流程有序启/停数据流读取控制器、比较器、加法器、数据流写入控制器,以及产生解压缩数据流的同步有效信号。9. The image decompression system according to claim 8, wherein the decompression state control machine is also used for collecting signals input from the data packet frame header detection module, data counter, OV address register, row counter and external users , generating image decompression process control signals according to the logic, sequentially starting/stopping the data stream reading controller, comparator, adder, and data stream writing controller according to a predetermined process, and generating a synchronous valid signal for decompressing the data stream. 10.根据权利要求4至9中任一项所述的图像解压缩系统,其中,还包括输入数据缓存模块和输出数据缓存模块;10. The image decompression system according to any one of claims 4 to 9, wherein, also comprising an input data cache module and an output data cache module; 所述输入数据缓存模块用于缓存图像压缩数据流中的图像数据,并将数据传输至行解压缩处理模块;The input data cache module is used to cache the image data in the image compression data stream, and transmit the data to the row decompression processing module; 所述输出数据缓存模块连接行解压缩处理模块,用于缓存并输出第一帧原始图像数据以及后续每一帧图像数据。The output data buffering module is connected to the row decompression processing module, and is used for buffering and outputting the first frame of original image data and each subsequent frame of image data.
CN201710826772.4A 2017-09-13 2017-09-13 An image decompression method and system Active CN107592541B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710826772.4A CN107592541B (en) 2017-09-13 2017-09-13 An image decompression method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710826772.4A CN107592541B (en) 2017-09-13 2017-09-13 An image decompression method and system

Publications (2)

Publication Number Publication Date
CN107592541A true CN107592541A (en) 2018-01-16
CN107592541B CN107592541B (en) 2022-03-04

Family

ID=61051617

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710826772.4A Active CN107592541B (en) 2017-09-13 2017-09-13 An image decompression method and system

Country Status (1)

Country Link
CN (1) CN107592541B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112839230A (en) * 2021-01-20 2021-05-25 北京思朗科技有限责任公司 Image data compression apparatus and image data decompression apparatus
CN114615209A (en) * 2022-03-11 2022-06-10 山东云海国创云计算装备产业创新中心有限公司 Dynamic adaptive image compression method, device, equipment and readable medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130279607A1 (en) * 2012-04-24 2013-10-24 Tektronix, Inc Tiling or blockiness detection based on spectral power signature
CN106550237A (en) * 2015-09-16 2017-03-29 中国科学院深圳先进技术研究院 A kind of monitoring video compression method
CN106791844A (en) * 2016-12-19 2017-05-31 中国科学院半导体研究所 A kind of Lossless Image Compression Algorithm device and method

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130279607A1 (en) * 2012-04-24 2013-10-24 Tektronix, Inc Tiling or blockiness detection based on spectral power signature
CN106550237A (en) * 2015-09-16 2017-03-29 中国科学院深圳先进技术研究院 A kind of monitoring video compression method
CN106791844A (en) * 2016-12-19 2017-05-31 中国科学院半导体研究所 A kind of Lossless Image Compression Algorithm device and method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112839230A (en) * 2021-01-20 2021-05-25 北京思朗科技有限责任公司 Image data compression apparatus and image data decompression apparatus
CN112839230B (en) * 2021-01-20 2023-04-28 上海思朗科技有限公司 Image data compression device and image data decompression device
CN114615209A (en) * 2022-03-11 2022-06-10 山东云海国创云计算装备产业创新中心有限公司 Dynamic adaptive image compression method, device, equipment and readable medium
CN114615209B (en) * 2022-03-11 2024-03-08 山东云海国创云计算装备产业创新中心有限公司 Dynamic adaptive image compression method, device, equipment and readable medium

Also Published As

Publication number Publication date
CN107592541B (en) 2022-03-04

Similar Documents

Publication Publication Date Title
CN105611295B (en) A kind of system and method for realizing video sampling and compressing transmission on SOC
US7689047B2 (en) Reduced buffer size for JPEG encoding
CN101478643A (en) Method and system for data collecting
EP2787738B1 (en) Tile-based compression for graphic applications
CN103647937A (en) An image tracking system and an image data processing method thereof
CN100422986C (en) Apparatus for performing discrete cosine transform/inverse discrete cosine transform and method thereof
CN103139567B (en) The method and apparatus of a kind of image compression and decompression
CN103888777A (en) Video image compression/decompression device
CN102868871B (en) Method and device for converting video image format
CN115209145A (en) Video compression method, system, device and readable storage medium
CN101316364A (en) image compression system
CN105979201A (en) Intelligent wearable device based on parallel processor
CN101599167B (en) Access method of memory
CN107592541A (en) A kind of image decompression method and system
CN107659815B (en) Image decompression method and device for executing the same
CN112422985B (en) Multi-core parallel hardware coding method and device suitable for JPEG
CN110351562A (en) A kind of 10 bit YUV image storage formats
CN106791844B (en) An image lossless compression device and method
CN110490312B (en) Pooling calculation method and circuit
CN105005464A (en) Burrows Wheeler Transform hardware processing apparatus
CN105023021A (en) Characteristic matching method based on principal direction template
CN104954749B (en) A kind of information recording method
Tyagi et al. Autoencoder image compression for high compression and acceptable quality
CN116320395A (en) Image processing method, device, electronic equipment and readable storage medium
CN106791843A (en) A kind of Lossless Image Compression Algorithm system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant