CN102088604B - A method and device for compressing video thumbnails - Google Patents
A method and device for compressing video thumbnails Download PDFInfo
- Publication number
- CN102088604B CN102088604B CN 201110035631 CN201110035631A CN102088604B CN 102088604 B CN102088604 B CN 102088604B CN 201110035631 CN201110035631 CN 201110035631 CN 201110035631 A CN201110035631 A CN 201110035631A CN 102088604 B CN102088604 B CN 102088604B
- Authority
- CN
- China
- Prior art keywords
- run
- bit
- length
- compression
- rgb format
- 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
- 238000007906 compression Methods 0.000 claims abstract description 187
- 230000006835 compression Effects 0.000 claims abstract description 184
- 238000000034 method Methods 0.000 claims abstract description 43
- 239000011159 matrix material Substances 0.000 claims description 21
- 230000002457 bidirectional effect Effects 0.000 claims description 6
- 238000007726 management method Methods 0.000 description 10
- 230000000694 effects Effects 0.000 description 6
- 230000003044 adaptive effect Effects 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 238000002156 mixing Methods 0.000 description 2
- 230000008520 organization Effects 0.000 description 2
- 239000003973 paint Substances 0.000 description 2
- 241000282414 Homo sapiens Species 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 238000013144 data compression Methods 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Images
Landscapes
- Compression Of Band Width Or Redundancy In Fax (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
Description
技术领域 technical field
本发明涉及影片缩略图的处理技术领域,尤其涉及一种影片缩略图的压缩方法及压缩装置。 The invention relates to the technical field of video thumbnail processing, in particular to a method and device for compressing video thumbnails.
背景技术 Background technique
有损压缩,是利用人类对图像或声波中的某些频率成分不敏感的特性,允许压缩过程中损失一定的信息,虽然不能完全恢复原始数据,但是所损失的部分对理解原始图像的影响较小,且压缩率较高。有损压缩广泛应用于语音,图像和视频数据的压缩。一般地,影片缩略图的压缩通常采用基于浮点运算的有损压缩。 Lossy compression utilizes the insensitivity of human beings to certain frequency components in images or sound waves, allowing certain information to be lost during the compression process. Although the original data cannot be completely restored, the lost part has a greater impact on understanding the original image. Small and high compression ratio. Lossy compression is widely used in the compression of speech, image and video data. Generally, the compression of movie thumbnails usually adopts lossy compression based on floating-point operations.
游程编码,游程编码又称“运行长度编码”或“行程编码”,其基本原理是:用一个符号值或串长代替具有相同值的连续符号(连续符号构成了一段连续的“行程”。行程编码因此而得名),使符号长度少于原始数据的长度。只在各行或者各列数据的代码发生变化时,一次记录该代码及相同代码重复的个数,从而实现数据的压缩。 Run-length coding, also known as "run-length coding" or "run-length coding", its basic principle is: use a symbol value or string length to replace consecutive symbols with the same value (continuous symbols constitute a continuous "stroke". encoding (hence the name), making the symbol length less than the length of the original data. Only when the code of each row or column of data changes, the code and the number of repetitions of the same code are recorded at one time, so as to realize data compression.
无损压缩,是利用数据的统计冗余进行压缩,可完全回复原始数据而不引起任何失真。常见的无损压缩有LZ77编码压缩或LZ78编码压缩,LZ77或LZ78编码压缩均是基于滑动窗口字典的单向搜索匹配,匹配的长度取决于滑动窗口的大小。 Lossless compression is to use the statistical redundancy of data for compression, which can completely restore the original data without causing any distortion. Common lossless compressions include LZ77 encoding compression or LZ78 encoding compression. Both LZ77 and LZ78 encoding compression are based on one-way search and matching of the sliding window dictionary, and the matching length depends on the size of the sliding window.
在影片资源管理系统中,影片缩略图的文件数据量大,为了有效节省影片资源管理系统的空间,需要对影片缩略图进行压缩处理。一般地,现有的对影片缩略图的压缩一般采用上述三种压缩方式中的任一种,发明人发现,采用上述任一种方案对影片缩略图进行压缩均存在缺陷: In the video resource management system, the file data volume of the video thumbnail is large. In order to effectively save the space of the video resource management system, it is necessary to compress the video thumbnail. Generally, any one of the above-mentioned three compression methods is generally used in the existing compression of movie thumbnails, and the inventors have found that there are defects in using any of the above-mentioned schemes to compress movie thumbnails:
一、基于浮点运算的算法对影片缩略图进行有损压缩,其压缩率较高,但是由于浮点运算的算法较为复杂,因此采用此方案压缩速率低,易失真,且解码速度慢,不能完全恢复原始图像; 1. The algorithm based on floating-point arithmetic performs lossy compression on movie thumbnails, and its compression rate is relatively high. However, due to the complexity of the algorithm of floating-point arithmetic, the compression rate of this scheme is low, easy to be distorted, and the decoding speed is slow. Fully restore the original image;
二、游程编码的压缩率较低,尤其当影片缩略图的色彩较为丰富时,采用此方案的压缩效果不高,实用性较低; 2. The compression rate of run-length coding is low, especially when the color of the video thumbnail is relatively rich, the compression effect of this scheme is not high, and the practicability is low;
三、基于LZ77或LZ78编码压缩待无损压缩方案的压缩速度快,且不易失真,但该方案的压缩率较低,压缩效果不高。 3. The lossless compression scheme based on LZ77 or LZ78 coding compression has fast compression speed and is not easy to be distorted, but the compression rate of this scheme is low and the compression effect is not high.
发明内容 Contents of the invention
本发明实施例所要解决的技术问题在于,提供一种影片缩略图的压缩方法及压缩装置,有效地结合有损压缩、游程编码和无损压缩三种压缩方式对影片缩略图进行压缩,其压缩率较高,压缩速率高、失真度小、解码速度快。 The technical problem to be solved by the embodiments of the present invention is to provide a method and device for compressing film thumbnails, which can effectively combine lossy compression, run-length coding and lossless compression to compress film thumbnails. Higher, high compression rate, low distortion, fast decoding speed.
为了解决上述技术问题,本发明实施例提供了一种影片缩略图的压缩方法,包括: In order to solve the above technical problems, an embodiment of the present invention provides a method for compressing movie thumbnails, including:
对影片缩略图进行有损压缩,获得特定位数的影片缩略图; Perform lossy compression on video thumbnails to obtain video thumbnails with a specific number of digits;
对所述特定位数的影片缩略图进行游程编码; performing run-length encoding on the movie thumbnail image with a specific number of bits;
对游程编码后的影片缩略图进行无损压缩,获得压缩图片。 Perform lossless compression on the run-length coded video thumbnail to obtain a compressed image.
其中,所述影片缩略图为RGB(Red,Green,Blue,红绿蓝)格式的24位bmp位图。 Wherein, the movie thumbnail is a 24-bit bmp bitmap in RGB (Red, Green, Blue) format.
其中,所述对影片缩略图进行有损压缩,获得特定位数的影片缩略图,包括: Wherein, the lossy compression is performed on the thumbnail of the movie to obtain the thumbnail of the movie with a specific number of digits, including:
为影片的所有RGB格式的24位bmp位图创建统一调色板和统一头文件; Create a unified palette and a unified header for all 24-bit bmp bitmaps in RGB format for the movie;
采用基于逻辑运算的有损压缩算法,对每个RGB格式的24位bmp位图的像素点进行压缩,获得RGB格式的16位bmp位图。 A lossy compression algorithm based on logical operations is used to compress the pixels of each 24-bit bmp bitmap in RGB format to obtain a 16-bit bmp bitmap in RGB format.
其中,对所述特定位数的影片缩略图进行游程编码,包括: Wherein, performing run-length coding on the movie thumbnail with a specific number of digits includes:
采用矩阵存储方式存储影片的所有RGB格式的16位bmp位图; Use matrix storage to store all 16-bit bmp bitmaps in RGB format of the movie;
对所述矩阵存储的RGB格式的16位bmp位图进行Z字扫描; Z word scanning is carried out to the 16-bit bmp bitmap of the RGB format stored in the matrix;
根据Z字扫描结果,对所述矩阵存储的RGB格式的16位bmp位图进行游程编码。 Perform run-length encoding on the 16-bit bmp bitmap in RGB format stored in the matrix according to the zigzag scanning result.
其中,所述对游程编码后的影片缩略图进行无损压缩,获得压缩图片,包括: Wherein, the lossless compression is performed on the video thumbnail after the run-length encoding to obtain the compressed picture, including:
根据游程编码后的影片缩略图,双向扫描滑动窗口; Scan the sliding window in both directions according to the run-length coded video thumbnail;
判断所述滑动窗口中是否包括与所述游程编码后的影片缩略图相匹配的字符串,如果判断结果为是,输出五元符号组作为压缩图片,并将所述滑动窗口向后滑动匹配的最长字符串的长度加1个字符;如果判断结果为否,输出二元符号组作为压缩图片,并将所述滑动窗口向后滑动1个字符; Judging whether the sliding window includes a character string that matches the run-length coded movie thumbnail, if the judgment result is yes, outputting a five-element symbol group as a compressed picture, and sliding the matching backwards in the sliding window Add 1 character to the length of the longest character string; if the judgment result is no, output a binary symbol group as a compressed image, and slide the sliding window backward by 1 character;
重复上述步骤,直至所有的影片缩略图均压缩完成; Repeat the above steps until all video thumbnails are compressed;
其中,所述五元符号组包括:编码标志位bit、方向标志位dir、窗口内的偏移off、最大匹配长度len、下一字符c;所述二元符号组包括:编码标志位bit和当前字符e。 Wherein, the five-element symbol group includes: encoding flag bit, direction flag bit dir, offset off in the window, maximum matching length len, next character c; the binary symbol group includes: encoding flag bit and The current character e.
其中,所述off采用定长编码,所述len采用前缀编码。 Wherein, the off adopts fixed-length encoding, and the len adopts prefix encoding.
相应地,本发明实施例还提供了一种压缩装置,包括: Correspondingly, an embodiment of the present invention also provides a compression device, including:
有损压缩模块,用于对影片缩略图进行有损压缩,获得特定位数的影片缩略图; The lossy compression module is used to perform lossy compression on video thumbnails to obtain video thumbnails with a specific number of digits;
游程编码模块,用于对所述有损压缩模块获得的特定位数的影片缩略图进行游程编码; A run-length encoding module, configured to perform run-length encoding on the video thumbnail image of a specific number of bits obtained by the lossy compression module;
无损压缩模块,用于对所述游程编码模块编码后的影片缩略图进行无损压缩,获得压缩图片。 The lossless compression module is used to perform lossless compression on the movie thumbnail coded by the run-length coding module to obtain a compressed picture.
其中,所述影片缩略图为RGB格式的24位bmp位图,所述有损压缩模块包括: Wherein, the film thumbnail is a 24-bit bmp bitmap in RGB format, and the lossy compression module includes:
创建单元,用于为影片的所有RGB格式的24位bmp位图创建统一调色板和统一头文件; Creation unit for creating a unified palette and a unified header for all 24-bit bmp bitmaps in RGB format for the film;
有损压缩单元,用于采用基于逻辑运算的有损压缩算法,对每个RGB格式的24位bmp位图的像素点进行压缩,获得RGB格式的16位bmp位图。 The lossy compression unit is used to compress the pixels of each 24-bit bmp bitmap in RGB format by adopting a lossy compression algorithm based on logical operation to obtain a 16-bit bmp bitmap in RGB format.
其中,所述游程编码模块包括: Wherein, the run-length coding module includes:
存储单元,用于采用矩阵存储方式存储影片的所有RGB格式的16位bmp位图; The storage unit is used to store all 16-bit bmp bitmaps in RGB format of the film in a matrix storage mode;
扫描单元,用于对所述存储单元存储的RGB格式的16位bmp位图进行Z字扫描; A scanning unit, configured to perform Z-scanning on the 16-bit bmp bitmap in RGB format stored in the storage unit;
游程编码单元,用于根据所述扫描单元的Z字扫描结果,对所述矩阵存储的RGB格式的16位bmp位图进行游程编码。 A run-length encoding unit, configured to perform run-length encoding on the 16-bit bmp bitmap in RGB format stored in the matrix according to the Z-shaped scanning result of the scanning unit.
其中,所述无损压缩模块包括: Wherein, the lossless compression module includes:
双向扫描单元,用于根据游程编码后的影片缩略图,双向扫描滑动窗口; The bidirectional scanning unit is used to scan the sliding window bidirectionally according to the video thumbnail after run-length encoding;
判断单元,用于判断所述双向扫描单元扫描的所述滑动窗口中是否包括与所述游程编码后的影片缩略图相匹配的字符串; A judging unit, configured to judge whether the sliding window scanned by the two-way scanning unit includes a character string matching the run-length coded movie thumbnail;
无损压缩单元,用于当所述判断单元判断结果为是时,输出五元符号组作为压缩图片,并将所述滑动窗口向后滑动匹配的最长字符串的长度加1个字符;当所述判断单元判断结果为否时,输出二元符号组作为压缩图片,并将所述滑动窗口向后滑动1个字符; The lossless compression unit is used to output the five-element symbol group as a compressed picture when the judgment result of the judgment unit is yes, and add 1 character to the length of the longest character string matched by sliding the sliding window backwards; When the judgment result of the judging unit is no, the binary symbol group is output as a compressed picture, and the sliding window is slid backward by 1 character;
其中,所述五元符号组包括:编码标志位bit、方向标志位dir、窗口内的偏移off、最大匹配长度len、下一字符c;所述二元符号组包括:编码标志位bit和当前字符e。 Wherein, the five-element symbol group includes: encoding flag bit, direction flag bit dir, offset off in the window, maximum matching length len, next character c; the binary symbol group includes: encoding flag bit and The current character e.
实施本发明实施例,具有如下有益效果: Implementing the embodiment of the present invention has the following beneficial effects:
本发明实施例首先采用有损压缩减少影片缩略图的位数,获得特定位数的影片缩略图,此处有损压缩基于逻辑运算进行,其运算简单,既保证了压缩率,又提高了压缩速率,同时减小了失真度;然后对该特定位数的影片缩略图进行游程编码,并对游程编码后的影片缩略图进行无损压缩,比如基于滑动窗口字典的双向搜索匹配,获得最终压缩图片,本发明实施例在现有的LZ77或LZ78编码压缩进行改进,将常规的单向搜索匹配改进为双向搜索匹配,提高了压缩率,同时保证了原有的压缩速率和失真度;本发明实施例有效地结合了有损压缩、游程编码和无损压缩三种压缩方式,有效地节省了影片资源管理系统的空间,提高了解码速度,使影片缩略图的显示更流畅,提升了用户体验。 The embodiment of the present invention first uses lossy compression to reduce the number of digits of the movie thumbnail to obtain a movie thumbnail with a specific number of digits. Here, the lossy compression is based on logical operations, and the operation is simple, which not only ensures the compression ratio, but also improves the compression ratio. rate, while reducing the degree of distortion; then perform run-length encoding on the video thumbnail with a specific number of digits, and perform lossless compression on the run-length encoded video thumbnail, such as bidirectional search and matching based on a sliding window dictionary, to obtain the final compressed image , the embodiment of the present invention improves the existing LZ77 or LZ78 encoding and compression, and improves the conventional one-way search matching into two-way search matching, which improves the compression rate while ensuring the original compression rate and distortion; the implementation of the present invention The example effectively combines lossy compression, run-length encoding and lossless compression, which effectively saves the space of the video resource management system, improves the decoding speed, makes the display of video thumbnails smoother, and improves the user experience.
附图说明 Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。 In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1为本发明的压缩装置的实施例的结构示意图; Fig. 1 is the structural representation of the embodiment of compression device of the present invention;
图2为本发明的有损压缩模块的实施例的结构示意图; Fig. 2 is a schematic structural view of an embodiment of a lossy compression module of the present invention;
图3为本发明的游程编码模块的实施例的结构示意图; FIG. 3 is a schematic structural diagram of an embodiment of the run-length encoding module of the present invention;
图4为本发明的无损压缩模块的实施例的结构示意图; FIG. 4 is a schematic structural view of an embodiment of a lossless compression module of the present invention;
图5为本发明的影片缩略图的压缩方法的第一实施例的流程图; Fig. 5 is the flow chart of the first embodiment of the method for compressing movie thumbnails of the present invention;
图6为本发明的影片缩略图的压缩方法的第二实施例的流程图。 FIG. 6 is a flow chart of the second embodiment of the video thumbnail compression method of the present invention.
具体实施方式 Detailed ways
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。 The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present invention.
请参见图1,为本发明的压缩装置的实施例的结构示意图;所述压缩装置包括: Please refer to Fig. 1, which is a schematic structural view of an embodiment of a compression device of the present invention; the compression device includes:
有损压缩模块10,用于对影片缩略图进行有损压缩,获得特定位数的影片缩略图。
The
具体实现中,该有损压缩模块10可以为集成了基于逻辑运算的有损压缩算法的处理芯片等装置。一般地,原始的影片缩略图为RGB格式的24位bmp位图,所述有损压缩模块10主要用于将RGB格式的24位bmp位图压缩为RGB格式的16位bmp位图。
In a specific implementation, the
游程编码模块20,用于对所述有损压缩模块10获得的特定位数的影片缩略图进行游程编码。
The run-
所述游程编码模块20对所述有损压缩模块10获得的RGB格式的16位bmp位图进行编码,可以用少量的字节来描述更多的bmp位图数据,达到了进一步压缩的目的,尤其当各bmp位图的颜色比较单一时,采用游程编码方式可以获得比较好的压缩效果,且游程编码的编码过程不会失真。
The run-
无损压缩模块30,用于对所述游程编码模块20编码后的影片缩略图进行无损压缩,获得压缩图片。
The
具体实现中,所述无损压缩模块30采用基于滑动窗口的自适应字典编码压缩方式,将已经进行无损压缩的信息(即已经编码过的信息)作为滑动窗口,该滑动窗口的大小可根据实际需要进行设定。不同于现有的LZ77或LZ78编码压缩的单向搜索匹配方式,本实施例的无损压缩采用双向搜索匹配方式,当滑动窗口中存在相匹配的字符串时,所述无损压缩模块30输出五元符号组作为压缩图片,并将所述滑动窗口向后滑动匹配的最长字符串的长度加1个字符;当滑动窗口中无相匹配的字符串时,所述无损压缩模块30输出二元符号组作为压缩图片,并将所述滑动窗口向后滑动1个字符。其中,所述五元符号组包括:编码标志位bit、方向标志位dir、窗口内的偏移off、最大匹配长度len、下一字符c。其中,所述二元符号组包括:编码标志位bit和当前字符e。
In a specific implementation, the
本发明实施例有效地结合了有损压缩、游程编码和无损压缩三种压缩方式对影片缩略图进行压缩,其压缩率较高,压缩速率高、失真度小、解码速度快。 The embodiment of the present invention effectively combines lossy compression, run-length coding and lossless compression to compress movie thumbnails. The compression rate is high, the compression rate is high, the degree of distortion is small, and the decoding speed is fast.
为了更清楚的说明本发明,下面将对本发明的压缩装置中的各模块进行详细介绍。 In order to illustrate the present invention more clearly, each module in the compression device of the present invention will be introduced in detail below.
请参见图2,为本发明的有损压缩模块的实施例的结构示意图;所述有损压缩模块10包括:
Please refer to Fig. 2, which is a schematic structural diagram of an embodiment of the lossy compression module of the present invention; the
创建单元101,用于为影片的所有RGB格式的24位bmp位图创建统一调色板和统一头文件。
The
24位bmp位图包括:头文件和调色板;其中,头文件包含bmp位图的类型、显示内容等信息;调色板为用来调和并搁置新鲜颜料的平整板面。影片的各缩略图(RGB格式的24位bmp位图)可能包含不同的头文件和调色板,影片资源管理系统需要同时存储各bmp位图的头文件和调色板,从而浪费了极大的存储空间。所述创建单元101为影片的所有RGB格式的24位bmp位图创建统一调色板和统一头文件,则影片资源管理系统仅需要存储该统一调色板和统一头文件,各bmp位图共享该统一调色板和统一头文件,不仅节省了影片资源管理系统的存储空间,同时大大压缩了bmp位图的冗余数据。
The 24-bit bmp bitmap includes: a header file and a palette; wherein, the header file contains information such as the type of the bmp bitmap, display content, etc.; the palette is a flat surface for blending and shelving fresh paint. Each thumbnail of the movie (24-bit bmp bitmap in RGB format) may contain different header files and palettes. The movie resource management system needs to store the header files and palettes of each bmp bitmap at the same time, which wastes a lot of storage space. The
有损压缩单元102,用于采用基于逻辑运算的有损压缩算法,对每个RGB格式的24位bmp位图的像素点进行压缩,获得RGB格式的16位bmp位图。
The
bmp位图,亦称为点阵图像或绘制图像,是由像素点组成的。RGB格式的24位bmp位图的每个像素点即为24位(3个字节),由RGB表示,其组织格式为:R+G+B(R为8bit,G为8bit,B为8bit)。所述有损压缩单元102采用基于逻辑运算的有损压缩算法,对24位bmp位图的每个像素点进行压缩,具体为:去除每个像素点中的R的后3位,使其压缩为5bit;去除每个像素点中的G的后2位,使其压缩为6bit;去除每个像素点中的B的后3位,使其压缩为5bit;经过上述压缩,RGB格式的24位bmp位图的3个字节(24位)的像素点被压缩为2个字节(16位)的像素点,其组织格式为R+G+B(R为5bit,G为6bit,B为5bit)。比如:颜色为红色的24位bmp位图,其R=0xff,G=0x00,B=0x00,所述有损压缩单元102采用基于逻辑运算的有损压缩算法进行压缩,其算法为:dev_red_color=((((B)& 0xf8)>> 3)︱(((G)& 0xfc )<< 3)︱(((R)& 0xf8)<< 8));最后,所有的红色的24位bmp位图均为0xf800,即转换为红色的16位bmp位图。需要说明的是,所述有损压缩单元102采用基于逻辑运算的有损压缩算法进行压缩,运算简单,保证了压缩率;上述压缩过程中,去除每个像素点中的R的后3位、G的后2位、 B的后3位并不会影响该bmp位图的显示,保证了压缩的低失真度。
BMP bitmap, also known as bitmap image or drawing image, is composed of pixels. Each pixel of a 24-bit bmp bitmap in RGB format is 24 bits (3 bytes), represented by RGB, and its organizational format is: R+G+B (R is 8bit, G is 8bit, B is 8bit ). The
本发明实施例采用有损压缩减少影片缩略图的位数,获得特定位数的影片缩略图,此处有损压缩基于逻辑运算进行,其运算简单,既保证了压缩率,又提高了压缩速率,同时减小了失真度。 The embodiment of the present invention uses lossy compression to reduce the number of digits of the movie thumbnail, and obtains a movie thumbnail with a specific number of digits. Here, the lossy compression is based on logical operations, and the operation is simple, which not only ensures the compression rate, but also improves the compression rate. , while reducing distortion.
请参见图3,为本发明的游程编码模块的实施例的结构示意图;所述游程编码模块20包括:
Please refer to FIG. 3 , which is a schematic structural diagram of an embodiment of the run-length encoding module of the present invention; the run-
存储单元201,用于采用矩阵存储方式存储影片的所有RGB格式的16位bmp位图。
The
经所述有损压缩模块10压缩后,影片缩略图均为RGB格式的16位bmp位图,各影片缩略图的规格大小一样,所述存储单元201,则采用矩阵存储方式将影片的所有RGB格式的16位bmp位图进行存储。比如:假设两个RGB格式的16位bmp位图分别为:000001111100000和000000000011111,其中,0和1均表示16位bmp位图的颜色;该两个RGB格式的16位bmp位图经所述存储单元201存储后,其矩阵如下:
After being compressed by the
000001111100000 000001111100000
000000000011111 000000000011111
扫描单元202,用于对所述存储单元201存储的RGB格式的16位bmp位图进行Z字扫描。
The
依上述例子,所述扫描单元202对所述存储单元201存储的矩阵进行Z字扫描后,依次得到:5个0,5个1,15个0,5个1。
According to the above example, after the scanning unit 202 Z-scans the matrix stored in the
游程编码单元203,用于根据所述扫描单元202的Z字扫描结果,对所述矩阵存储的RGB格式的16位bmp位图进行游程编码。
The run-
依上述例子,所述游程编码单元203根据所述扫描单元202的Z字扫描结果,采用颜色加颜色长度的编码方式来描述bmp位图,则所述游程编码单元203编码后的结果为:0#5+1#5+0#15+1#5;其中,“#”前面表示bmp位图的颜色,“#”后面表示该颜色的长度。采用游程编码对RGB格式的16位bmp位图进行编码,可以用少量的字节来描述更多的bmp位图数据,达到了进一步压缩的目的,尤其当各bmp位图的颜色比较单一时,采用游程编码方式可以获得比较好的压缩效果,且游程编码的编码过程不会失真。
According to the above example, the run-
本发明实施例的运算简单,压缩速率高,失真度小。 The embodiment of the present invention has simple operation, high compression rate and low distortion.
请参见图4,为本发明的无损压缩模块的实施例的结构示意图;所述无损压缩模块30包括:
Please refer to Fig. 4, which is a schematic structural diagram of an embodiment of the lossless compression module of the present invention; the
双向扫描单元301,用于根据游程编码后的影片缩略图,双向扫描滑动窗口; A bi-directional scanning unit 301, configured to scan the sliding window bi-directionally according to the run-length coded film thumbnail;
具体实现中,本发明实施例的无损压缩采用基于滑动窗口的自适应字典编码压缩方式,采用已经进行无损压缩的信息(即已经编码过的信息)作为滑动窗口,该滑动窗口的大小可根据实际需要进行设定。不同于现有的LZ77或LZ78编码压缩的单向搜索匹配方式,本实施例的无损压缩采用双向搜索匹配方式,所述双向扫描单元301则根据游程编码后的影片缩略图,双向扫描滑动窗口,以实现双向搜索匹配。 In the specific implementation, the lossless compression in the embodiment of the present invention adopts the adaptive dictionary coding compression method based on the sliding window, and uses the information that has undergone lossless compression (that is, the information that has been encoded) as the sliding window. The size of the sliding window can be determined according to the actual situation. Settings are required. Different from the unidirectional search and matching method of the existing LZ77 or LZ78 encoding and compression, the lossless compression of this embodiment adopts a bidirectional search and matching method, and the bidirectional scanning unit 301 scans the sliding window bidirectionally according to the thumbnail image after the run-length encoding, To achieve bidirectional search matching.
判断单元302,用于判断所述双向扫描单元301扫描的所述滑动窗口中是否包括与所述游程编码后的影片缩略图相匹配的字符串;
A judging
无损压缩单元303,用于当所述判断单元302判断结果为是时,输出五元符号组作为压缩图片,并将所述滑动窗口向后滑动匹配的最长字符串的长度加1个字符;当所述判断单元判断结果为否时,输出二元符号组作为压缩图片,并将所述滑动窗口向后滑动1个字符。
A
具体实现中,所述五元符号组包括:编码标志位bit:表明该压缩图片是否经过基于滑动窗口的字典编码,bit=1,表明已经编码;bit=0,表明未编码;方向标志位dir:表明该压缩图片进行基于滑动窗口的字典编码压缩时,其滑动窗口的扫描方向,dir=1,表明从前至后进行扫描,dir=0,表明从后至前进行扫描;窗口内的偏移off:表明最大匹配长度的字符串在滑动窗口中的偏移位置;最大匹配长度len:表明滑动窗口中与所述游程编码后的影片缩略图相匹配的最长字符串的长度;下一字符c。所述无损压缩单元303当所述判断单元302判断结果为是时,输出五元符号组(bit,dir,off,len,c)作为压缩图片,并将所述滑动窗口向后滑动len+1个字符。
In the specific implementation, the five-element symbol group includes: encoding flag bit: indicates whether the compressed picture has been encoded through a dictionary based on a sliding window, bit=1, indicating that it has been encoded; bit=0, indicating that it is not encoded; the direction flag dir : Indicates the scanning direction of the sliding window when the compressed image is compressed by dictionary encoding based on the sliding window, dir=1 indicates scanning from front to back, dir=0 indicates scanning from back to front; offset within the window off: indicates the offset position of the character string with the maximum matching length in the sliding window; the maximum matching length len: indicates the length of the longest character string in the sliding window that matches the movie thumbnail after the run-length encoding; the next character c. The
所述off采用定长编码,其编码off需要的位数bitnum=upper_bound(MAX_WND_SIZE),其中,MAX_WND_SIZE为最大滑动窗口大小。所述len采用前缀编码,优选地,所述len采用范式哈夫曼编码,实际应用中,所述len还可采用Golomb编码或 编码等前缀编码方式。 The off uses fixed-length coding, and the number of bits required for coding off is bitnum=upper_bound (MAX_WND_SIZE), where MAX_WND_SIZE is the maximum sliding window size. The len is coded by a prefix, preferably, the len is coded in normal form Huffman, and in practical applications, the len can also be coded by Golomb or Encoding and other prefix encoding methods.
所述二元符号组包括:编码标志位bit和当前字符e。所述无损压缩单元303当所述判断单元302判断结果为否时,输出五元符号组(bit,e)作为压缩图片,并将所述滑动窗口向后滑动1个字符。
The binary symbol group includes: a coding flag bit and a current character e. When the determination result of the
可以理解的是,所述无损压缩模块30中的各单元重复上述工作,直至所有的影片缩略图均压缩完成。
It can be understood that each unit in the
本发明实施例在现有的LZ77或LZ78编码压缩进行改进,将常规的单向搜索匹配改进为双向搜索匹配,提高了压缩率,同时保证了原有的压缩速率和失真度。 The embodiment of the present invention improves the existing LZ77 or LZ78 encoding and compression, and improves the conventional one-way search and matching into two-way search and matching, which improves the compression rate and ensures the original compression rate and distortion.
为了更清楚的说明本发明,下面将对所述压缩装置对影片缩略图所执行的压缩方法进行详细介绍。 In order to illustrate the present invention more clearly, the compression method performed by the compression device on movie thumbnails will be described in detail below.
请参见图5,为本发明的影片缩略图的压缩方法的第一实施例的流程图;所述方法包括: Please refer to Fig. 5, which is a flow chart of the first embodiment of the method for compressing movie thumbnails of the present invention; the method includes:
S101,对影片缩略图进行有损压缩,获得特定位数的影片缩略图。 S101. Perform lossy compression on the video thumbnail to obtain a video thumbnail with a specific number of bits.
具体实现中,所述S101可以由集成了基于逻辑运算的有损压缩算法的处理芯片等装置执行。一般地,原始的影片缩略图为RGB格式的24位bmp位图,所述S101将RGB格式的24位bmp位图压缩为RGB格式的16位bmp位图。 In a specific implementation, the S101 may be executed by a device such as a processing chip integrated with a lossy compression algorithm based on logical operations. Generally, the original movie thumbnail is a 24-bit bmp bitmap in RGB format, and the S101 compresses the 24-bit bmp bitmap in RGB format into a 16-bit bmp bitmap in RGB format.
S102,对所述特定位数的影片缩略图进行游程编码。 S102. Perform run-length encoding on the video thumbnail image with a specific number of digits.
所述S102对所述S101获得的RGB格式的16位bmp位图进行编码,可以用少量的字节来描述更多的bmp位图数据,达到了进一步压缩的目的,尤其当各bmp位图的颜色比较单一时,采用游程编码方式可以获得比较好的压缩效果,且游程编码的编码过程不会失真。 Said S102 encodes the 16-bit bmp bitmap in RGB format obtained in said S101, and can use a small amount of bytes to describe more bmp bitmap data, thereby achieving the purpose of further compression, especially when each bmp bitmap When the color is relatively single, a better compression effect can be obtained by using the run-length encoding method, and the encoding process of the run-length encoding will not be distorted.
S103,对游程编码后的影片缩略图进行无损压缩,获得压缩图片。 S103. Perform lossless compression on the run-length coded movie thumbnail to obtain a compressed picture.
具体实现中,所述S103采用基于滑动窗口的自适应字典编码压缩方式,将已经进行无损压缩的信息(即已经编码过的信息)作为滑动窗口,该滑动窗口的大小可根据实际需要进行设定。不同于现有的LZ77或LZ78编码压缩的单向搜索匹配方式,本实施例的无损压缩采用双向搜索匹配方式,当滑动窗口中存在相匹配的字符串时,所述S103输出五元符号组作为压缩图片,并将所述滑动窗口向后滑动匹配的最长字符串的长度加1个字符;当滑动窗口中无相匹配的字符串时,所述S103输出二元符号组作为压缩图片,并将所述滑动窗口向后滑动1个字符。其中,所述五元符号组包括:编码标志位bit、方向标志位dir、窗口内的偏移off、最大匹配长度len、下一字符c。其中,所述二元符号组包括:编码标志位bit和当前字符e。 In the specific implementation, the S103 adopts the adaptive dictionary encoding compression method based on the sliding window, and uses the information that has undergone lossless compression (that is, the information that has been encoded) as the sliding window, and the size of the sliding window can be set according to actual needs. . Different from the one-way search matching method of the existing LZ77 or LZ78 encoding compression, the lossless compression of this embodiment adopts the two-way search matching method. When there is a matching character string in the sliding window, the S103 outputs the five-element symbol group as Compress the picture, and add 1 character to the length of the longest character string matched by sliding the sliding window backwards; when there is no matching character string in the sliding window, the S103 outputs a binary symbol group as a compressed picture, and Slide the sliding window backward by 1 character. Wherein, the five-element symbol group includes: encoding flag bit, direction flag bit dir, offset off in the window, maximum matching length len, and next character c. Wherein, the binary symbol group includes: a coding flag bit and a current character e.
本发明实施例有效地结合了有损压缩、游程编码和无损压缩三种压缩方式对影片缩略图进行压缩,其压缩率较高,压缩速率高、失真度小、解码速度快。 The embodiment of the present invention effectively combines lossy compression, run-length coding and lossless compression to compress movie thumbnails. The compression rate is high, the compression rate is high, the degree of distortion is small, and the decoding speed is fast.
请参见图6,为本发明的影片缩略图的压缩方法的第二实施例的流程图;所述方法包括: Please refer to FIG. 6, which is a flow chart of the second embodiment of the method for compressing movie thumbnails of the present invention; the method includes:
S201,为影片的所有RGB格式的24位bmp位图创建统一调色板和统一头文件。 S201, creating a unified palette and a unified header file for all 24-bit bmp bitmaps in RGB format of the movie.
24位bmp位图包括:头文件和调色板;其中,头文件包含bmp位图的类型、显示内容等信息;调色板为用来调和并搁置新鲜颜料的平整板面。影片的各缩略图(RGB格式的24位bmp位图)可能包含不同的头文件和调色板,影片资源管理系统需要同时存储各bmp位图的头文件和调色板,从而浪费了极大的存储空间。所述S201为影片的所有RGB格式的24位bmp位图创建统一调色板和统一头文件,则影片资源管理系统仅需要存储该统一调色板和统一头文件,各bmp位图共享该统一调色板和统一头文件,不仅节省了影片资源管理系统的存储空间,同时大大压缩了bmp位图的冗余数据。 The 24-bit bmp bitmap includes: a header file and a palette; wherein, the header file contains information such as the type of the bmp bitmap, display content, etc.; the palette is a flat surface for blending and shelving fresh paint. Each thumbnail of the movie (24-bit bmp bitmap in RGB format) may contain different header files and palettes. The movie resource management system needs to store the header files and palettes of each bmp bitmap at the same time, which wastes a lot of storage space. Said S201 creates a unified palette and a unified header file for all 24-bit bmp bitmaps in RGB format of the movie, then the movie resource management system only needs to store the unified palette and the unified header file, and each bmp bitmap shares the unified palette. The color palette and the unified header file not only save the storage space of the video resource management system, but also greatly compress the redundant data of the bmp bitmap.
S202,采用基于逻辑运算的有损压缩算法,对每个RGB格式的24位bmp位图的像素点进行压缩,获得RGB格式的16位bmp位图。 S202, using a lossy compression algorithm based on logical operations to compress the pixels of each 24-bit bmp bitmap in RGB format to obtain a 16-bit bmp bitmap in RGB format.
bmp位图,亦称为点阵图像或绘制图像,是由像素点组成的。RGB格式的24位bmp位图的每个像素点即为24位(3个字节),由RGB表示,其组织格式为:R+G+B(R为8bit,G为8bit,B为8bit)。所述S202采用基于逻辑运算的有损压缩算法,对24位bmp位图的每个像素点进行压缩,具体为:去除每个像素点中的R的后3位,使其压缩为5bit;去除每个像素点中的G的后2位,使其压缩为6bit;去除每个像素点中的B的后3位,使其压缩为5bit;经过上述压缩,RGB格式的24位bmp位图的3个字节(24位)的像素点被压缩为2个字节(16位)的像素点,其组织格式为R+G+B(R为5bit,G为6bit,B为5bit)。比如:颜色为红色的24位bmp位图,其R=0xff,G=0x00,B=0x00,所述S202采用基于逻辑运算的有损压缩算法进行压缩,其算法为:dev_red_color=((((B)& 0xf8)>> 3)︱(((G)& 0xfc )<< 3)︱(((R)& 0xf8)<< 8));最后,所有的红色的24位bmp位图均为0xf800,即转换为红色的16位bmp位图。需要说明的是,所述S202采用基于逻辑运算的有损压缩算法进行压缩,运算简单,保证了压缩率;上述压缩过程中,去除每个像素点中的R的后3位、G的后2位、B的后3位并不会影响该bmp位图的显示,保证了压缩的低失真度。 BMP bitmap, also known as bitmap image or drawing image, is composed of pixels. Each pixel of a 24-bit bmp bitmap in RGB format is 24 bits (3 bytes), represented by RGB, and its organizational format is: R+G+B (R is 8bit, G is 8bit, B is 8bit ). The S202 uses a lossy compression algorithm based on logic operations to compress each pixel of the 24-bit bmp bitmap, specifically: removing the last 3 bits of R in each pixel to compress it to 5 bits; removing The last 2 bits of G in each pixel make it compressed to 6 bits; remove the last 3 bits of B in each pixel to make it compressed to 5 bits; after the above compression, the 24-bit bmp bitmap in RGB format 3-byte (24-bit) pixels are compressed into 2-byte (16-bit) pixels, and its organization format is R+G+B (5 bits for R, 6 bits for G, and 5 bits for B). For example: a 24-bit bmp bitmap whose color is red, its R=0xff, G=0x00, B=0x00, the S202 is compressed using a lossy compression algorithm based on logical operations, and its algorithm is: dev_red_color=(((( B) & 0xf8) >> 3)︱(((G)&0xfc)<<3)︱(((R)&0xf8)<<8)); Finally, all red 24-bit bmp bitmaps are 0xf800, which is a 16-bit bmp bitmap converted to red. It should be noted that the S202 uses a logical operation-based lossy compression algorithm for compression, the operation is simple, and the compression rate is guaranteed; in the above compression process, the last 3 bits of R and the last 2 bits of G in each pixel are removed. bit and the last 3 bits of B will not affect the display of the bmp bitmap, which ensures low compression distortion.
本实施例中,S201-S202为上一实施例的S101的具体细化步骤。 In this embodiment, S201-S202 are specific detailed steps of S101 in the previous embodiment.
S203,采用矩阵存储方式存储影片的所有RGB格式的16位bmp位图。 S203, adopting a matrix storage method to store all 16-bit bmp bitmaps in RGB format of the film.
经所述S202压缩后,影片缩略图均为RGB格式的16位bmp位图,各影片缩略图的规格大小一样,所述S203则采用矩阵存储方式将影片的所有RGB格式的16位bmp位图进行存储。比如:假设两个RGB格式的16位bmp位图分别为:000001111100000和000000000011111,其中,0和1均表示16位bmp位图的颜色;该两个RGB格式的16位bmp位图经所述S203存储后,其矩阵如下: After being compressed by said S202, the movie thumbnails are all 16-bit bmp bitmaps in RGB format, and the specifications and sizes of each movie thumbnail are the same, and said S203 uses matrix storage to store all 16-bit bmp bitmaps in RGB format to store. For example: suppose two 16-bit bmp bitmaps in RGB format are respectively: 000001111100000 and 000000000011111, wherein 0 and 1 represent the color of 16-bit bmp bitmaps; the 16-bit bmp bitmaps in these two RGB formats are passed through the S203 After storage, its matrix is as follows:
000001111100000 000001111100000
000000000011111 000000000011111
S204,对所述矩阵存储的RGB格式的16位bmp位图进行Z字扫描。 S204. Z-scan the 16-bit bmp bitmap in RGB format stored in the matrix.
依上述例子,所述S204对所述S203存储的矩阵进行Z字扫描后,依次得到:5个0,5个1,15个0,5个1。 According to the above example, after the said S204 Z-scan the matrix stored in the said S203, sequentially obtain: 5 0s, 5 1s, 15 0s, 5 1s.
S205,根据Z字扫描结果,对所述矩阵存储的RGB格式的16位bmp位图进行游程编码。 S205. Perform run-length encoding on the 16-bit bmp bitmap in RGB format stored in the matrix according to the Z-scanning result.
依上述例子,所述S205根据所述S204的Z字扫描结果,采用颜色加颜色长度的编码方式来描述bmp位图,则所述S205编码后的结果为:0#5+1#5+0#15+1#5;其中,“#”前面表示bmp位图的颜色,“#”后面表示该颜色的长度。采用游程编码对RGB格式的16位bmp位图进行编码,可以用少量的字节来描述更多的bmp位图数据,达到了进一步压缩的目的,尤其当各bmp位图的颜色比较单一时,采用游程编码方式可以获得比较好的压缩效果,且游程编码的编码过程不会失真。 According to the above example, the S205 describes the bmp bitmap by using the encoding method of color plus color length according to the Z-scanning result of the S204, and the encoded result of the S205 is: 0#5+1#5+0 #15+1#5; Among them, the front of "#" indicates the color of the bmp bitmap, and the back of "#" indicates the length of the color. The 16-bit bmp bitmap in RGB format is encoded by run-length coding, and more bmp bitmap data can be described with a small number of bytes, which achieves the purpose of further compression, especially when the color of each bmp bitmap is relatively single. A relatively good compression effect can be obtained by using the run-length encoding method, and the encoding process of the run-length encoding will not be distorted.
本实施例中,S203-S205为上一实施例的S102的具体细化步骤。 In this embodiment, S203-S205 are specific detailed steps of S102 in the previous embodiment.
S206,根据游程编码后的影片缩略图,双向扫描滑动窗口。 S206. Bidirectionally scan the sliding window according to the run-length coded video thumbnail.
具体实现中,本发明实施例的无损压缩采用基于滑动窗口的自适应字典编码压缩方式,采用已经进行无损压缩的信息(即已经编码过的信息)作为滑动窗口,该滑动窗口的大小可根据实际需要进行设定。不同于现有的LZ77或LZ78编码压缩的单向搜索匹配方式,本实施例的无损压缩采用双向搜索匹配方式,所述S206则根据游程编码后的影片缩略图,双向扫描滑动窗口,以实现双向搜索匹配。 In the specific implementation, the lossless compression in the embodiment of the present invention adopts the adaptive dictionary coding compression method based on the sliding window, and uses the information that has undergone lossless compression (that is, the information that has been encoded) as the sliding window. The size of the sliding window can be determined according to the actual situation. Settings are required. Different from the unidirectional search and matching method of the existing LZ77 or LZ78 encoding and compression, the lossless compression of this embodiment adopts a two-way search and matching method, and the S206 scans the sliding window in both directions according to the thumbnail of the run-length coded film, so as to realize two-way Search for matches.
S207,判断所述滑动窗口中是否包括与所述游程编码后的影片缩略图相匹配的字符串,如果判断结果为是,转入S208;否则,转入S209。 S207, judging whether the sliding window includes a character string matching the run-length coded movie thumbnail, if the judging result is yes, go to S208; otherwise, go to S209.
S208,输出五元符号组作为压缩图片,并将所述滑动窗口向后滑动匹配的最长字符串的长度加1个字符;之后,转入S210。 S208, outputting a five-element symbol group as a compressed picture, and adding 1 character to the length of the longest character string matched by sliding the sliding window backwards; after that, turn to S210.
具体实现中,所述五元符号组包括:编码标志位bit:表明该压缩图片是否经过基于滑动窗口的字典编码,bit=1,表明已经编码;bit=0,表明未编码;方向标志位dir:表明该压缩图片进行基于滑动窗口的字典编码压缩时,其滑动窗口的扫描方向,dir=1,表明从前至后进行扫描,dir=0,表明从后至前进行扫描;窗口内的偏移off:表明最大匹配长度的字符串在滑动窗口中的偏移位置;最大匹配长度len:表明滑动窗口中与所述游程编码后的影片缩略图相匹配的最长字符串的长度;下一字符c。所述S208当所述S207判断结果为是时,输出五元符号组(bit,dir,off,len,c)作为压缩图片,并将所述滑动窗口向后滑动len+1个字符。所述off采用定长编码,其编码off需要的位数bitnum=upper_bound(MAX_WND_SIZE)。所述len采用前缀编码,优选地,所述len采用范式哈夫曼编码,实际应用中,所述len还可采用Golomb编码或编码等前缀编码方式。 In the specific implementation, the five-element symbol group includes: encoding flag bit: indicates whether the compressed picture has been encoded through a dictionary based on a sliding window, bit=1, indicating that it has been encoded; bit=0, indicating that it has not been encoded; the direction flag bit dir : Indicates the scanning direction of the sliding window when the compressed image is compressed by dictionary encoding based on the sliding window. dir=1 indicates scanning from front to back, dir=0 indicates scanning from back to front; the offset within the window off: indicates the offset position of the character string with the maximum matching length in the sliding window; the maximum matching length len: indicates the length of the longest character string in the sliding window that matches the movie thumbnail after the run-length encoding; the next character c. In S208, when the judgment result in S207 is yes, output a five-element symbol group (bit, dir, off, len, c) as a compressed picture, and slide the sliding window backward by len+1 characters. The off uses fixed-length coding, and the number of bits required for coding off is bitnum=upper_bound(MAX_WND_SIZE). The len is coded by a prefix, preferably, the len is coded in normal form Huffman, and in practical applications, the len can also be coded by Golomb or Encoding and other prefix encoding methods.
S209,输出二元符号组作为压缩图片,并将所述滑动窗口向后滑动1个字符。 S209. Output binary symbol groups as compressed pictures, and slide the sliding window backward by 1 character.
所述二元符号组包括:编码标志位bit和当前字符e。所述S209当所述S207判断结果为否时,输出五元符号组(bit,e)作为压缩图片,并将所述滑动窗口向后滑动1个字符。 The binary symbol group includes: a coding flag bit and a current character e. In said S209, when the determination result of said S207 is No, output a five-element symbol group (bit, e) as a compressed picture, and slide the sliding window backward by 1 character.
S210,判断是否所有的影片缩略图均完成压缩,如果判断结果为是,则结束;否则,转入S207。 S210, judging whether all the movie thumbnails have been compressed, if the judging result is yes, then end; otherwise, go to S207.
本实施例中,S206-S210为上一实施例的S103的具体细化步骤。 In this embodiment, S206-S210 are detailed steps of S103 in the previous embodiment.
本发明实施例有效地结合了有损压缩、游程编码和无损压缩三种压缩方式对影片缩略图进行压缩,其压缩率较高,压缩速率高、失真度小、解码速度快。 The embodiment of the present invention effectively combines lossy compression, run-length coding and lossless compression to compress movie thumbnails. The compression rate is high, the compression rate is high, the degree of distortion is small, and the decoding speed is fast.
通过上述实施例的描述,本发明实施例首先采用有损压缩减少影片缩略图的位数,获得特定位数的影片缩略图,此处有损压缩基于逻辑运算进行,其运算简单,既保证了压缩率,又提高了压缩速率,同时减小了失真度;然后对该特定位数的影片缩略图进行游程编码,并对游程编码后的影片缩略图进行无损压缩,比如基于滑动窗口字典的双向搜索匹配,获得最终压缩图片,本发明实施例在现有的LZ77或LZ78编码压缩进行改进,将常规的单向搜索匹配改进为双向搜索匹配,提高了压缩率,同时保证了原有的压缩速率和失真度;本发明实施例有效地结合了有损压缩、游程编码和无损压缩三种压缩方式,有效地节省了影片资源管理系统的空间,提高了解码速度,使影片缩略图的显示更流畅,提升了用户体验。 Through the description of the above embodiments, the embodiment of the present invention first uses lossy compression to reduce the number of digits of the movie thumbnail to obtain a movie thumbnail with a specific number of digits. Here, the lossy compression is based on logical operations, and the operation is simple, which ensures The compression rate increases the compression rate and reduces the distortion; then run-length encoding is performed on the video thumbnail of the specific number of digits, and the lossless compression is performed on the video thumbnail after the run-length encoding, such as two-way based on the sliding window dictionary Search and match to obtain the final compressed picture. The embodiment of the present invention improves the existing LZ77 or LZ78 encoding and compression, and improves the conventional one-way search and match to two-way search and match, which improves the compression rate and ensures the original compression rate at the same time and distortion; the embodiment of the present invention effectively combines lossy compression, run-length coding and lossless compression three compression methods, effectively saves the space of the film resource management system, improves the decoding speed, and makes the display of film thumbnails smoother , which improves the user experience.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分游程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的游程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。 Those of ordinary skill in the art can understand that realizing all or part of the runs in the methods of the above-mentioned embodiments can be completed by instructing related hardware through a computer program, and the program can be stored in a computer-readable storage medium, the program During execution, the runs as in the embodiments of the above-mentioned methods may be included. Wherein, the storage medium may be a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM) or a random access memory (Random Access Memory, RAM), etc.
以上所揭露的仅为本发明一种较佳实施例而已,当然不能以此来限定本发明之权利范围,本领域普通技术人员可以理解实现上述实施例的全部或部分游程,并依本发明权利要求所作的等同变化,仍属于发明所涵盖的范围。 What is disclosed above is only a preferred embodiment of the present invention, and certainly not to limit the scope of rights of the present invention. Those of ordinary skill in the art can understand that all or part of the above-mentioned embodiments can be realized, and according to the rights of the present invention The equivalent changes required still belong to the scope covered by the invention.
Claims (2)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201110035631 CN102088604B (en) | 2011-02-10 | 2011-02-10 | A method and device for compressing video thumbnails |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN 201110035631 CN102088604B (en) | 2011-02-10 | 2011-02-10 | A method and device for compressing video thumbnails |
Publications (2)
Publication Number | Publication Date |
---|---|
CN102088604A CN102088604A (en) | 2011-06-08 |
CN102088604B true CN102088604B (en) | 2013-06-26 |
Family
ID=44100179
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN 201110035631 Expired - Fee Related CN102088604B (en) | 2011-02-10 | 2011-02-10 | A method and device for compressing video thumbnails |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN102088604B (en) |
Families Citing this family (19)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102289829A (en) * | 2011-07-12 | 2011-12-21 | 北京朗玛数联科技有限公司 | Method and device for storing and restoring image and system for processing image |
CN102833463A (en) * | 2012-08-13 | 2012-12-19 | 华为技术有限公司 | Picture processing method and picture processing equipment |
BR112016012417B1 (en) * | 2013-12-18 | 2023-04-11 | Hfi Innovation Inc | METHOD AND APPARATUS FOR INITIALIZING AND MANAGING A PALETTE |
KR102144329B1 (en) * | 2013-12-31 | 2020-08-13 | 엘지디스플레이 주식회사 | Organic Light Emitting Display Device and Method of Driving The Same |
US10469870B2 (en) | 2014-09-26 | 2019-11-05 | Kt Corporation | Method and apparatus for predicting and restoring a video signal using palette entry |
KR102470832B1 (en) | 2014-10-20 | 2022-11-28 | 주식회사 케이티 | Method and apparatus for processing a video signal |
WO2016114583A1 (en) | 2015-01-15 | 2016-07-21 | 주식회사 케이티 | Method and device for processing video signal |
KR102422485B1 (en) | 2015-01-29 | 2022-07-20 | 주식회사 케이티 | Method and apparatus for processing a video signal |
WO2016122251A1 (en) | 2015-01-29 | 2016-08-04 | 주식회사 케이티 | Method and apparatus for processing video signals |
US20160234494A1 (en) * | 2015-02-10 | 2016-08-11 | Qualcomm Incorporated | Restriction on palette block size in video coding |
CN111031326B (en) | 2015-04-02 | 2022-02-11 | 株式会社Kt | Method for processing video signal |
CN108111858B (en) * | 2016-11-24 | 2020-06-05 | 腾讯科技(深圳)有限公司 | Picture compression method and device |
CN106850785A (en) * | 2017-01-20 | 2017-06-13 | 济南浪潮高新科技投资发展有限公司 | A kind of physical message system data compression transmitting method of use sliding window caching |
CN107196660A (en) * | 2017-04-24 | 2017-09-22 | 南京数维康信息科技有限公司 | Low power consumption data compression algorithm |
CN107220028B (en) * | 2017-05-24 | 2020-05-29 | 上海兆芯集成电路有限公司 | Accelerated compression method and apparatus using the same |
CN110572664A (en) * | 2019-08-14 | 2019-12-13 | 中国地质大学(武汉) | A New BMP Image Compression Method and System |
CN113438444B (en) * | 2021-03-25 | 2023-04-28 | 贵州电网有限责任公司 | Picture transmission storage method and system |
CN113656617A (en) * | 2021-07-22 | 2021-11-16 | 南京信息职业技术学院 | A kind of picture lossless compression storage method, system and intelligent mobile terminal |
CN116032294B (en) * | 2023-02-23 | 2023-06-20 | 山东安之捷科技有限公司 | Intelligent processing method for atmosphere monitoring data |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1630371A (en) * | 2003-12-19 | 2005-06-22 | 联想(北京)有限公司 | A method of lossless image compression applied to real time transmission |
CN101350881A (en) * | 2008-09-03 | 2009-01-21 | 王文延 | A Lossless Compression and Decompression Method of JPEG Image |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7162080B2 (en) * | 2001-02-23 | 2007-01-09 | Zoran Corporation | Graphic image re-encoding and distribution system and method |
-
2011
- 2011-02-10 CN CN 201110035631 patent/CN102088604B/en not_active Expired - Fee Related
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1630371A (en) * | 2003-12-19 | 2005-06-22 | 联想(北京)有限公司 | A method of lossless image compression applied to real time transmission |
CN101350881A (en) * | 2008-09-03 | 2009-01-21 | 王文延 | A Lossless Compression and Decompression Method of JPEG Image |
Non-Patent Citations (1)
Title |
---|
冷星星 等.高压缩低损耗图像编码算法研究.《成都信息工程学院学报》.2008,第23卷(第2期),182-186. * |
Also Published As
Publication number | Publication date |
---|---|
CN102088604A (en) | 2011-06-08 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN102088604B (en) | A method and device for compressing video thumbnails | |
TWI239489B (en) | System and method for progressively transforming and coding digital data | |
US5818877A (en) | Method for reducing storage requirements for grouped data values | |
WO2018184468A1 (en) | Image file processing method, device and storage medium | |
US8902992B2 (en) | Decoder for selectively decoding predetermined data units from a coded bit stream | |
CN1407510A (en) | Cartoon image compression method | |
CN113170140B (en) | Method for encoding data element, method for decoding data stream, device and medium | |
US8682091B2 (en) | Real-time image compression | |
JP3522331B2 (en) | Data compression method | |
TWI479456B (en) | Method and apparatus for data compression using error plane coding | |
TW200937875A (en) | Compression system for a bit-plane | |
EP2787738A1 (en) | Tile-based compression and decompression for graphic applications | |
CN1251492C (en) | Frame compression using radix approximation or differential code and escape code | |
CN110971904B (en) | Control method for image compression | |
US20090067733A1 (en) | Byte Representation for Enhanced Image Compression | |
US6404927B1 (en) | Control point generation and data packing for variable length image compression | |
Mathpal et al. | A research paper on lossless data compression techniques | |
US20090096642A1 (en) | Entropy Codec with Variable Divisor | |
US8600181B2 (en) | Method for compressing images and a format for compressed images | |
CN103227920B (en) | A kind of multichannel satellite image lossless compression method | |
CN103139566B (en) | Method for the efficiently decoding of variable-length code (VLC) | |
US20150023609A1 (en) | Method and apparatus for decoding a progressive jpeg image | |
CN110191341B (en) | Depth data coding method and decoding method | |
US8446299B2 (en) | Method and device for encoding and decoding of data in unique number values | |
CN1182488C (en) | Data compression/decompression method and image data compression/decompression device |
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 | ||
C56 | Change in the name or address of the patentee |
Owner name: SHENZHEN SKYWORTH DIGITAL TECHNOLOGY CO., LTD. Free format text: FORMER NAME: SKY-WORTH DIGITAL TECHNOLOGY CO., LTD.;SHENZHEN CITY |
|
CP01 | Change in the name or title of a patent holder |
Address after: 518000 Guangdong city of Shenzhen province Nanshan District Gao Xin Road Building A14, SKYWORTH Patentee after: SHENZHEN SKYWORTH DIGITAL TECHNOLOGY Co.,Ltd. Address before: 518000 Guangdong city of Shenzhen province Nanshan District Gao Xin Road Building A14, SKYWORTH Patentee before: SHENZHEN SKYWORTH DIGITAL TECHNOLOGY Co.,Ltd. |
|
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20130626 |
|
CF01 | Termination of patent right due to non-payment of annual fee |