CN102088604A - Method and device for compressing film thumbnails - Google Patents

Method and device for compressing film thumbnails Download PDF

Info

Publication number
CN102088604A
CN102088604A CN 201110035631 CN201110035631A CN102088604A CN 102088604 A CN102088604 A CN 102088604A CN 201110035631 CN201110035631 CN 201110035631 CN 201110035631 A CN201110035631 A CN 201110035631A CN 102088604 A CN102088604 A CN 102088604A
Authority
CN
China
Prior art keywords
film
run
length coding
thumbnail
bmp
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN 201110035631
Other languages
Chinese (zh)
Other versions
CN102088604B (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.)
Shenzhen Skyworth Digital Technology Co Ltd
Original Assignee
Shenzhen Skyworth Digital Technology Co Ltd
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 Shenzhen Skyworth Digital Technology Co Ltd filed Critical Shenzhen Skyworth Digital Technology Co Ltd
Priority to CN 201110035631 priority Critical patent/CN102088604B/en
Publication of CN102088604A publication Critical patent/CN102088604A/en
Application granted granted Critical
Publication of CN102088604B publication Critical patent/CN102088604B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

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

Abstract

The embodiment of the invention discloses a method for compressing film thumbnails, comprising the following steps: carrying out loss compression on the film thumbnails to acquire film thumbnails with specific digits; carrying out run coding on the film thumbnails with the specific digits; and carrying out lossless compression on the film thumbnails which are subjected to the run coding to acquire compressed pictures. The embodiment of the invention also provides a device for compressing film thumbnails. In the invention, the loss compression, the run coding and the lossless compression are combined effectively to compress the film thumbnails, thus having the advantages of higher compression ratio, high compression efficiency, low degree of distortion and fast decoding speed.

Description

A kind of compression method of film thumbnail and compression set
Technical field
The present invention relates to the processing technology field of film thumbnail, relate in particular to a kind of compression method and compression set of film thumbnail.
Background technology
Lossy compression method, be to utilize the mankind, allow the certain information of loss in the compression process, though can not recover initial data fully to the insensitive characteristic of some frequency content in image or the sound wave, but the part of being lost is less to the influence of understanding original image, and compression ratio is higher.Lossy compression method is widely used in voice, image and compression of video data.Usually, the lossy compression method based on floating-point operation is adopted in the compression of film thumbnail usually.
Run-Length Coding, Run-Length Coding claim " run length coding " or " run-length encoding " again, and its basic principle is: (continuous symbol has constituted one section continuous " stroke " with the long continuous symbol that replaces having identical value of a value of symbol or string.Therefore run-length encoding gains the name), make symbol lengths be less than the length of initial data.Only when the code of each row or each columns certificate changes, once write down the number that this code and same code repeat, thereby realize the compression of data.
Lossless compress is to utilize the statistical redundancy of data to compress, and can reply initial data fully and does not cause any distortion.Common lossless compress has LZ77 encoding compression or LZ78 encoding compression, and LZ77 or LZ78 encoding compression all are based on the unidirectional search coupling of sliding window dictionary, and the length of coupling depends on the size of sliding window.
In the film resource management system, the file data amount of film thumbnail is big, in order effectively to save the space of film resource management system, need compress processing to the film thumbnail.Usually, any in the above-mentioned three kinds of compress modes of the general employing of existing compression to the film thumbnail, the inventor finds, adopts above-mentioned any scheme that the film thumbnail is compressed and all have defective:
One, the algorithm based on floating-point operation carries out lossy compression method to the film thumbnail, and its compression ratio is higher, but because the algorithm of floating-point operation is comparatively complicated, therefore adopts this scheme compression speed low, easily distortion, and decoding speed is slow, can not recover original image fully;
Two, the compression ratio of Run-Length Coding is lower, especially when the color of film thumbnail during than horn of plenty, adopts the compression effectiveness of this scheme not high, and practicality is lower;
Three, treat that based on LZ77 or LZ78 encoding compression the compression speed of lossless compression scheme is fast, and be difficult for distortion, but the compression ratio of this scheme is lower, compression effectiveness is not high.
Summary of the invention
Embodiment of the invention technical problem to be solved is, a kind of compression method and compression set of film thumbnail are provided, in conjunction with lossy compression method, Run-Length Coding and three kinds of compress modes of lossless compress the film thumbnail is compressed effectively, its compression ratio is higher, and the compression speed height, the distortion factor is little, decoding speed is fast.
In order to solve the problems of the technologies described above, the embodiment of the invention provides a kind of compression method of film thumbnail, comprising:
The film thumbnail is carried out lossy compression method, obtain the film thumbnail of particular number of bits;
Film thumbnail to described particular number of bits carries out Run-Length Coding;
Film thumbnail behind the Run-Length Coding is carried out lossless compress, obtain compressed picture.
Wherein, described film thumbnail is RGB(Red, Green, Blue, RGB) 24 bmp bitmaps of form.
Wherein, described the film thumbnail is carried out lossy compression method, obtains the film thumbnail of particular number of bits, comprising:
For 24 bmp bitmaps of all rgb formats of film are created unified palettes and unified header file;
Adopt the lossy compression method algorithm of logic-based computing, the pixel of 24 bmp bitmaps of each rgb format is compressed, obtain 16 bmp bitmaps of rgb format.
Wherein, the film thumbnail of described particular number of bits is carried out Run-Length Coding, comprising:
Adopt the matrix stores mode to store 16 bmp bitmaps of all rgb formats of film;
16 bmp bitmaps to the rgb format of described matrix stores carry out the scanning of Z word;
According to Z word scanning result, 16 bmp bitmaps of the rgb format of described matrix stores are carried out Run-Length Coding.
Wherein, described film thumbnail behind the Run-Length Coding is carried out lossless compress, obtains compressed picture, comprising:
According to the film thumbnail behind the Run-Length Coding, bilateral scanning sliding window;
Judge whether comprise in the described sliding window with described Run-Length Coding after the character string that is complementary of film thumbnail, if judged result is for being, export five metasymbol groups as compressed picture, and the length of long character string that described sliding window slides backward coupling is added 1 character; If judged result is exported the binary symbols as compressed picture for not, and described sliding window is slided backward 1 character;
Repeat above-mentioned steps, all compress until all film thumbnails and finish;
Wherein, described five metasymbol groups comprise: skew off, maximum matching length len, next character c in coding maker position bit, direction flag dir, the window; Described binary symbols comprises: coding maker position bit and current character e.
Wherein, described off adopts block code, and described len adopts prefix code.
Correspondingly, the embodiment of the invention also provides a kind of compression set, comprising:
The lossy compression method module is used for the film thumbnail is carried out lossy compression method, obtains the film thumbnail of particular number of bits;
The Run-Length Coding module, the film thumbnail that is used for particular number of bits that described lossy compression method module is obtained carries out Run-Length Coding;
The lossless compress module is used for the film thumbnail behind the described Run-Length Coding module coding is carried out lossless compress, obtains compressed picture.
Wherein, described film thumbnail is 24 bmp bitmaps of rgb format, and described lossy compression method module comprises:
Creating unit is used to 24 bmp bitmaps of all rgb formats of film to create unified palette and unified header file;
The lossy compression method unit is used to adopt the lossy compression method algorithm of logic-based computing, and the pixel of 24 bmp bitmaps of each rgb format is compressed, and obtains 16 bmp bitmaps of rgb format.
Wherein, described Run-Length Coding module comprises:
Memory cell, 16 bmp bitmaps of all rgb formats that are used to adopt the matrix stores mode to store film;
Scanning element is used for 16 bmp bitmaps of the rgb format of described cell stores are carried out the scanning of Z word;
The Run-Length Coding unit is used for the Z word scanning result according to described scanning element, and 16 bmp bitmaps of the rgb format of described matrix stores are carried out Run-Length Coding.
Wherein, described lossless compress module comprises:
The bilateral scanning unit is used for according to the film thumbnail behind the Run-Length Coding, bilateral scanning sliding window;
Judging unit, the described sliding window that is used for judging described bilateral scanning unit scan whether comprise with described Run-Length Coding after the character string that is complementary of film thumbnail;
Lossless compression unit, be used for when described judgment unit judges result when being, export five metasymbol groups as compressed picture, and the length of long character string that described sliding window slides backward coupling added 1 character; When described judgment unit judges result for not the time, output binary symbols is as compressed picture, and described sliding window is slided backward 1 character;
Wherein, described five metasymbol groups comprise: skew off, maximum matching length len, next character c in coding maker position bit, direction flag dir, the window; Described binary symbols comprises: coding maker position bit and current character e.
Implement the embodiment of the invention, have following beneficial effect:
The embodiment of the invention at first adopts the figure place of lossy compression method minimizing film thumbnail, obtains the film thumbnail of particular number of bits, and lossy compression method logic-based computing is herein carried out, its computing is simple, both guarantee compression ratio, improved compression speed again, reduced the distortion factor simultaneously; Film thumbnail to this particular number of bits carries out Run-Length Coding then, and the film thumbnail behind the Run-Length Coding carried out lossless compress, such as bidirectional research coupling based on the sliding window dictionary, obtain final compressed picture, the embodiment of the invention is improved at existing LZ77 or LZ78 encoding compression, the unidirectional search coupling of routine is improved to the bidirectional research coupling, has improved compression ratio, guaranteed the original compression speed and the distortion factor simultaneously; The embodiment of the invention combines lossy compression method, Run-Length Coding and three kinds of compress modes of lossless compress effectively, has saved the space of film resource management system effectively, has improved decoding speed, makes the demonstration of film thumbnail more smooth, has promoted user experience.
Description of drawings
In order to be illustrated more clearly in the embodiment of the invention or technical scheme of the prior art, to do to introduce simply to the accompanying drawing of required use in embodiment or the description of the Prior Art below, apparently, accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
Fig. 1 is the structural representation of the embodiment of compression set of the present invention;
Fig. 2 is the structural representation of the embodiment of lossy compression method module of the present invention;
Fig. 3 is the structural representation of the embodiment of Run-Length Coding module of the present invention;
Fig. 4 is the structural representation of the embodiment of lossless compress module of the present invention;
Fig. 5 is the flow chart of first embodiment of the compression method of film thumbnail of the present invention;
Fig. 6 is the flow chart of second embodiment of the compression method of film thumbnail of the present invention.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the invention, the technical scheme in the embodiment of the invention is clearly and completely described, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills belong to the scope of protection of the invention not making the every other embodiment that is obtained under the creative work prerequisite.
See also Fig. 1, be the structural representation of the embodiment of compression set of the present invention; Described compression set comprises:
Lossy compression method module 10 is used for the film thumbnail is carried out lossy compression method, obtains the film thumbnail of particular number of bits.
In the specific implementation, this lossy compression method module 10 can be the devices such as process chip of the lossy compression method algorithm of integrated logic-based computing.Usually, original film thumbnail is 24 bmp bitmaps of rgb format, and described lossy compression method module 10 is mainly used in 16 bmp bitmaps with 24 bmp bitmap boil down to rgb formats of rgb format.
Run-Length Coding module 20, the film thumbnail that is used for particular number of bits that described lossy compression method module 10 is obtained carries out Run-Length Coding.
16 bmp bitmaps of the rgb format that 20 pairs of described lossy compression method modules 10 of described Run-Length Coding module obtain are encoded, can more bmp data bitmap be described with a spot of byte, reached the purpose of further compression, the color competitive list a period of time of especially working as each bmp bitmap, adopt the Run-Length Coding mode can obtain reasonable compression effectiveness, and the cataloged procedure of Run-Length Coding can distortion.
Lossless compress module 30 is used for the film thumbnail behind described Run-Length Coding module 20 codings is carried out lossless compress, obtains compressed picture.
In the specific implementation, the self-adapting dictionary encoding compression mode that described lossless compress module 30 adopts based on sliding window, as sliding window, the big I of this sliding window is set according to actual needs with the information (information of promptly having encoded) of carrying out lossless compress.The unidirectional search matching way that is different from existing LZ77 or LZ78 encoding compression, the lossless compress of present embodiment adopts the bidirectional research matching way, when having the character string that is complementary in the sliding window, described lossless compress module 30 outputs five metasymbol groups are as compressed picture, and the length that described sliding window slides backward the longest character string of coupling is added 1 character; When not having the character string that is complementary in the sliding window, described lossless compress module 30 is exported the binary symbols as compressed picture, and described sliding window is slided backward 1 character.Wherein, described five metasymbol groups comprise: skew off, maximum matching length len, next character c in coding maker position bit, direction flag dir, the window.Wherein, described binary symbols comprises: coding maker position bit and current character e.
The embodiment of the invention combines lossy compression method, Run-Length Coding and three kinds of compress modes of lossless compress effectively the film thumbnail is compressed, and its compression ratio is higher, and the compression speed height, the distortion factor is little, decoding speed is fast.
For clearer explanation the present invention, will each module in the compression set of the present invention be described in detail below.
See also Fig. 2, be the structural representation of the embodiment of lossy compression method module of the present invention; Described lossy compression method module 10 comprises:
Creating unit 101 is used to 24 bmp bitmaps of all rgb formats of film to create unified palette and unified header file.
24 bmp bitmaps comprise: header file and palette; Wherein, header file comprises the information such as type, displaying contents of bmp bitmap; Palette is to be used for being in harmonious proportion and to shelve the formation plate face of fresh pigment.Each thumbnail of film (24 bmp bitmaps of rgb format) may comprise different header files and palette, and the film resource management system need be stored the header file and the palette of each bmp bitmap simultaneously, thereby has wasted great memory space.24 bmp bitmaps of all rgb formats that described creating unit 101 is a film are created unified palette and unified header file, then the film resource management system only needs to store this and unifies palette and unified header file, each bmp bitmap is shared this and is unified palette and unified header file, not only save the memory space of film resource management system, greatly reduced the redundant data of bmp bitmap simultaneously.
Lossy compression method unit 102 is used to adopt the lossy compression method algorithm of logic-based computing, and the pixel of 24 bmp bitmaps of each rgb format is compressed, and obtains 16 bmp bitmaps of rgb format.
The bmp bitmap also is called dot matrix image or drawing image, is made up of pixel.Each pixel of 24 bmp bitmaps of rgb format is 24 (3 bytes), and represented that by RGB its organized formats is: R+G+B(R is 8bit, and G is 8bit, and B is 8bit).Described lossy compression method unit 102 adopts the lossy compression method algorithm of logic-based computings, and each pixels of 24 bmp bitmaps is compressed, and is specially: remove R in each pixel back 3, make its boil down to 5bit; Remove G in each pixel back 2, make its boil down to 6bit; Remove B in each pixel back 3, make its boil down to 5bit; Through above-mentioned compression, the pixel of 3 bytes (24) of 24 bmp bitmaps of rgb format is compressed to 2 bytes (16 s') pixel, and its organized formats is that R+G+B(R is 5bit, and G is 6bit, and B is 5bit).Such as: color is 24 red bmp bitmaps, its R=0xff, and G=0x00, B=0x00, described lossy compression method unit 102 adopts the lossy compression method algorithm of logic-based computings to compress, and its algorithm is: dev_red_color=((((B) ﹠amp; 0xf8)〉〉 3) ︱ (((G) ﹠amp; 0xfc)<<3) ︱ (((R) ﹠amp; 0xf8)<<8)); At last, 24 bmp bitmaps of all redness are 0xf800, promptly are converted to 16 red bmp bitmaps.Need to prove that described lossy compression method unit 102 adopts the lossy compression method algorithm of logic-based computing to compress, computing is simple, has guaranteed compression ratio; In the above-mentioned compression process, remove back 3 of R in each pixel, back 2 of G, back 3 demonstrations that can't influence this bmp bitmap of B, guaranteed the low distortion of compression.
The embodiment of the invention adopts the figure place of lossy compression method minimizing film thumbnail, obtains the film thumbnail of particular number of bits, and lossy compression method logic-based computing is herein carried out, its computing is simple, both guarantee compression ratio, improved compression speed again, reduced the distortion factor simultaneously.
See also Fig. 3, be the structural representation of the embodiment of Run-Length Coding module of the present invention; Described Run-Length Coding module 20 comprises:
Memory cell 201,16 bmp bitmaps of all rgb formats that are used to adopt the matrix stores mode to store film.
After described lossy compression method module 10 compressions, the film thumbnail is 16 bmp bitmaps of rgb format, the specification size of each film thumbnail is the same, and described memory cell 201 then adopts the matrix stores mode that 16 bmp bitmaps of all rgb formats of film are stored.Such as: 16 bmp bitmaps supposing two rgb formats are respectively: 000001111100000 and 000000000011111, wherein, 0 and 1 all represents the color of 16 bmp bitmaps; 16 bmp bitmaps of these two rgb formats are after described memory cell 201 storages, and its matrix is as follows:
000001111100000
000000000011111
Scanning element 202 is used for 16 bmp bitmaps of the rgb format of described memory cell 201 storages are carried out the scanning of Z word.
According to above-mentioned example, after the matrix of 202 pairs of described memory cell 201 storages of described scanning element carries out the scanning of Z word, obtain successively: 50,51,15 0,51.
Run-Length Coding unit 203 is used for the Z word scanning result according to described scanning element 202, and 16 bmp bitmaps of the rgb format of described matrix stores are carried out Run-Length Coding.
According to above-mentioned example, described Run-Length Coding unit 203 is according to the Z word scanning result of described scanning element 202, the coded system that adopts color to add color length is described the bmp bitmap, and the result behind then described Run-Length Coding unit 203 codings is: 0#5+1#5+0#15+1#5; Wherein, the color of bmp bitmap is represented in " # " front, and the length of this color is represented in " # " back.Adopt Run-Length Coding that 16 bmp bitmaps of rgb format are encoded, can more bmp data bitmap be described with a spot of byte, reached the purpose of further compression, the color competitive list a period of time of especially working as each bmp bitmap, adopt the Run-Length Coding mode can obtain reasonable compression effectiveness, and the cataloged procedure of Run-Length Coding can distortion.
The computing of the embodiment of the invention is simple, the compression speed height, and the distortion factor is little.
See also Fig. 4, be the structural representation of the embodiment of lossless compress module of the present invention; Described lossless compress module 30 comprises:
Bilateral scanning unit 301 is used for according to the film thumbnail behind the Run-Length Coding, bilateral scanning sliding window;
In the specific implementation, the lossless compress of the embodiment of the invention adopts the self-adapting dictionary encoding compression mode based on sliding window, adopt the information (information of promptly having encoded) of having carried out lossless compress as sliding window, the big I of this sliding window is set according to actual needs.The unidirectional search matching way that is different from existing LZ77 or LZ78 encoding compression, the lossless compress of present embodiment adopts the bidirectional research matching way, 301 of described bilateral scanning unit are according to the film thumbnail behind the Run-Length Coding, and the bilateral scanning sliding window is to realize the bidirectional research coupling.
Judging unit 302, the described sliding window that is used for judging 301 scannings of described bilateral scanning unit whether comprise with described Run-Length Coding after the character string that is complementary of film thumbnail;
Lossless compression unit 303, be used for when described judging unit 302 judged results when being, export five metasymbol groups as compressed picture, and the length of long character string that described sliding window slides backward coupling added 1 character; When described judgment unit judges result for not the time, output binary symbols is as compressed picture, and described sliding window is slided backward 1 character.
In the specific implementation, described five metasymbol groups comprise: coding maker position bit: show whether this compressed picture passes through the dictionary encoding based on sliding window, bit=1 shows encoded; Bit=0 shows not coding; Direction flag dir: show when this compressed picture carries out based on the compression of the dictionary encoding of sliding window, the scanning direction of its sliding window, dir=1 shows from front to back and scans, dir=0, show from after to the line scanning of advancing; Skew off in the window: the deviation post of character string in sliding window that shows maximum matching length; Maximum matching length len: show in the sliding window with described Run-Length Coding after the length of the longest character string that is complementary of film thumbnail; Next character c.Described lossless compression unit 303 when described judging unit 302 judged results when being, export five metasymbol groups (bit, dir, off, len c) as compressed picture, and slides backward len+1 character with described sliding window.
Described off adopts block code, the figure place bitnum=upper_bound(MAX_WND_SIZE that its coding off needs), wherein, MAX_WND_SIZE is maximum sliding window size.Described len adopts prefix code, and preferably, described len adopts the normal form Huffman encoding, in the practical application, described len also can adopt the Golomb coding or
Figure 2011100356313100002DEST_PATH_IMAGE001
Prefix code modes such as coding.
Described binary symbols comprises: coding maker position bit and current character e.Described lossless compression unit 303 when described judging unit 302 judged results for not the time, (bit e) as compressed picture, and slides backward 1 character with described sliding window to export five metasymbol groups.
Be understandable that each unit in the described lossless compress module 30 repeats above-mentioned work, all compress until all film thumbnails and finish.
The embodiment of the invention is improved at existing LZ77 or LZ78 encoding compression, the unidirectional search of routine is mated be improved to the bidirectional research coupling, has improved compression ratio, has guaranteed the original compression speed and the distortion factor simultaneously.
For clearer explanation the present invention, will describe in detail to the performed compression method of film thumbnail to described compression set below.
See also Fig. 5, be the flow chart of first embodiment of the compression method of film thumbnail of the present invention; Described method comprises:
S101 carries out lossy compression method to the film thumbnail, obtains the film thumbnail of particular number of bits.
In the specific implementation, described S101 can be carried out by the devices such as process chip of the lossy compression method algorithm of integrated logic-based computing.Usually, original film thumbnail is 24 bmp bitmaps of rgb format, and described S101 is with 16 bmp bitmaps of 24 bmp bitmap boil down to rgb formats of rgb format.
S102 carries out Run-Length Coding to the film thumbnail of described particular number of bits.
Described S102 encodes to 16 bmp bitmaps of the rgb format that described S101 obtains, can more bmp data bitmap be described with a spot of byte, reached the purpose of further compression, the color competitive list a period of time of especially working as each bmp bitmap, adopt the Run-Length Coding mode can obtain reasonable compression effectiveness, and the cataloged procedure of Run-Length Coding can distortion.
S103 carries out lossless compress to the film thumbnail behind the Run-Length Coding, obtains compressed picture.
In the specific implementation, described S103 adopts the self-adapting dictionary encoding compression mode based on sliding window, and as sliding window, the big I of this sliding window is set according to actual needs with the information (information of promptly having encoded) of carrying out lossless compress.The unidirectional search matching way that is different from existing LZ77 or LZ78 encoding compression, the lossless compress of present embodiment adopts the bidirectional research matching way, when having the character string that is complementary in the sliding window, described S103 exports five metasymbol groups as compressed picture, and the length of long character string that described sliding window slides backward coupling is added 1 character; When not having the character string that is complementary in the sliding window, described S103 exports the binary symbols as compressed picture, and described sliding window is slided backward 1 character.Wherein, described five metasymbol groups comprise: skew off, maximum matching length len, next character c in coding maker position bit, direction flag dir, the window.Wherein, described binary symbols comprises: coding maker position bit and current character e.
The embodiment of the invention combines lossy compression method, Run-Length Coding and three kinds of compress modes of lossless compress effectively the film thumbnail is compressed, and its compression ratio is higher, and the compression speed height, the distortion factor is little, decoding speed is fast.
See also Fig. 6, be the flow chart of second embodiment of the compression method of film thumbnail of the present invention; Described method comprises:
S201 is for 24 bmp bitmaps of all rgb formats of film are created unified palettes and unified header file.
24 bmp bitmaps comprise: header file and palette; Wherein, header file comprises the information such as type, displaying contents of bmp bitmap; Palette is to be used for being in harmonious proportion and to shelve the formation plate face of fresh pigment.Each thumbnail of film (24 bmp bitmaps of rgb format) may comprise different header files and palette, and the film resource management system need be stored the header file and the palette of each bmp bitmap simultaneously, thereby has wasted great memory space.Described S201 is that 24 bmp bitmaps of all rgb formats of film are created unified palette and unified header file, then the film resource management system only needs to store this and unifies palette and unified header file, each bmp bitmap is shared this and is unified palette and unified header file, not only save the memory space of film resource management system, greatly reduced the redundant data of bmp bitmap simultaneously.
S202 adopts the lossy compression method algorithm of logic-based computing, and the pixel of 24 bmp bitmaps of each rgb format is compressed, and obtains 16 bmp bitmaps of rgb format.
The bmp bitmap also is called dot matrix image or drawing image, is made up of pixel.Each pixel of 24 bmp bitmaps of rgb format is 24 (3 bytes), and represented that by RGB its organized formats is: R+G+B(R is 8bit, and G is 8bit, and B is 8bit).Described S202 adopts the lossy compression method algorithm of logic-based computing, and each pixels of 24 bmp bitmaps is compressed, and is specially: remove R in each pixel back 3, make its boil down to 5bit; Remove G in each pixel back 2, make its boil down to 6bit; Remove B in each pixel back 3, make its boil down to 5bit; Through above-mentioned compression, the pixel of 3 bytes (24) of 24 bmp bitmaps of rgb format is compressed to 2 bytes (16 s') pixel, and its organized formats is that R+G+B(R is 5bit, and G is 6bit, and B is 5bit).Such as: color is 24 red bmp bitmaps, its R=0xff, and G=0x00, B=0x00, described S202 adopt the lossy compression method algorithm of logic-based computing to compress, and its algorithm is: dev_red_color=((((B) ﹠amp; 0xf8)〉〉 3) ︱ (((G) ﹠amp; 0xfc)<<3) ︱ (((R) ﹠amp; 0xf8)<<8)); At last, 24 bmp bitmaps of all redness are 0xf800, promptly are converted to 16 red bmp bitmaps.Need to prove that described S202 adopts the lossy compression method algorithm of logic-based computing to compress, computing is simple, has guaranteed compression ratio; In the above-mentioned compression process, remove back 3 of R in each pixel, back 2 of G, back 3 demonstrations that can't influence this bmp bitmap of B, guaranteed the low distortion of compression.
In the present embodiment, S201-S202 is the concrete refinement step of the S101 of a last embodiment.
S203 adopts the matrix stores mode to store 16 bmp bitmaps of all rgb formats of film.
After described S202 compression, the film thumbnail is 16 bmp bitmaps of rgb format, and the specification size of each film thumbnail is the same, and described S203 then adopts the matrix stores mode that 16 bmp bitmaps of all rgb formats of film are stored.Such as: 16 bmp bitmaps supposing two rgb formats are respectively: 000001111100000 and 000000000011111, wherein, 0 and 1 all represents the color of 16 bmp bitmaps; 16 bmp bitmaps of these two rgb formats are after described S203 storage, and its matrix is as follows:
000001111100000
000000000011111
S204 carries out the scanning of Z word to 16 bmp bitmaps of the rgb format of described matrix stores.
According to above-mentioned example, the matrix that described S204 stores described S203 obtains: 50,51,15 0,51 after carrying out the scanning of Z word successively.
S205 according to Z word scanning result, carries out Run-Length Coding to 16 bmp bitmaps of the rgb format of described matrix stores.
According to above-mentioned example, described S205 is according to the Z word scanning result of described S204, and the coded system that adopts color to add color length is described the bmp bitmap, and the result behind the then described S205 coding is: 0#5+1#5+0#15+1#5; Wherein, the color of bmp bitmap is represented in " # " front, and the length of this color is represented in " # " back.Adopt Run-Length Coding that 16 bmp bitmaps of rgb format are encoded, can more bmp data bitmap be described with a spot of byte, reached the purpose of further compression, the color competitive list a period of time of especially working as each bmp bitmap, adopt the Run-Length Coding mode can obtain reasonable compression effectiveness, and the cataloged procedure of Run-Length Coding can distortion.
In the present embodiment, S203-S205 is the concrete refinement step of the S102 of a last embodiment.
S206 is according to the film thumbnail behind the Run-Length Coding, bilateral scanning sliding window.
In the specific implementation, the lossless compress of the embodiment of the invention adopts the self-adapting dictionary encoding compression mode based on sliding window, adopt the information (information of promptly having encoded) of having carried out lossless compress as sliding window, the big I of this sliding window is set according to actual needs.The unidirectional search matching way that is different from existing LZ77 or LZ78 encoding compression, the lossless compress of present embodiment adopts the bidirectional research matching way, described S206 is then according to the film thumbnail behind the Run-Length Coding, and the bilateral scanning sliding window is to realize the bidirectional research coupling.
S207, judge whether comprise in the described sliding window with described Run-Length Coding after the character string that is complementary of film thumbnail, if judged result is for being to change S208 over to; Otherwise, change S209 over to.
S208 exports five metasymbol groups as compressed picture, and the length of long character string that described sliding window slides backward coupling is added 1 character; Afterwards, change S210 over to.
In the specific implementation, described five metasymbol groups comprise: coding maker position bit: show whether this compressed picture passes through the dictionary encoding based on sliding window, bit=1 shows encoded; Bit=0 shows not coding; Direction flag dir: show when this compressed picture carries out based on the compression of the dictionary encoding of sliding window, the scanning direction of its sliding window, dir=1 shows from front to back and scans, dir=0, show from after to the line scanning of advancing; Skew off in the window: the deviation post of character string in sliding window that shows maximum matching length; Maximum matching length len: show in the sliding window with described Run-Length Coding after the length of the longest character string that is complementary of film thumbnail; Next character c.Described S208 when described S207 judged result when being, export five metasymbol groups (bit, dir, off, len c) as compressed picture, and slides backward len+1 character with described sliding window.Described off adopts block code, the figure place bitnum=upper_bound(MAX_WND_SIZE that its coding off needs).Described len adopts prefix code, and preferably, described len adopts the normal form Huffman encoding, in the practical application, described len also can adopt the Golomb coding or Prefix code modes such as coding.
S209 exports the binary symbols as compressed picture, and described sliding window is slided backward 1 character.
Described binary symbols comprises: coding maker position bit and current character e.Described S209 when described S207 judged result for not the time, (bit e) as compressed picture, and slides backward 1 character with described sliding window to export five metasymbol groups.
S210 judges whether that all film thumbnails all finish compression, if judged result is for being then to finish; Otherwise, change S207 over to.
In the present embodiment, S206-S210 is the concrete refinement step of the S103 of a last embodiment.
The embodiment of the invention combines lossy compression method, Run-Length Coding and three kinds of compress modes of lossless compress effectively the film thumbnail is compressed, and its compression ratio is higher, and the compression speed height, the distortion factor is little, decoding speed is fast.
Description by the foregoing description, the embodiment of the invention at first adopts lossy compression method to reduce the figure place of film thumbnail, obtain the film thumbnail of particular number of bits, lossy compression method logic-based computing is herein carried out, its computing is simple, both guarantee compression ratio, improved compression speed again, reduced the distortion factor simultaneously; Film thumbnail to this particular number of bits carries out Run-Length Coding then, and the film thumbnail behind the Run-Length Coding carried out lossless compress, such as bidirectional research coupling based on the sliding window dictionary, obtain final compressed picture, the embodiment of the invention is improved at existing LZ77 or LZ78 encoding compression, the unidirectional search coupling of routine is improved to the bidirectional research coupling, has improved compression ratio, guaranteed the original compression speed and the distortion factor simultaneously; The embodiment of the invention combines lossy compression method, Run-Length Coding and three kinds of compress modes of lossless compress effectively, has saved the space of film resource management system effectively, has improved decoding speed, makes the demonstration of film thumbnail more smooth, has promoted user experience.
One of ordinary skill in the art will appreciate that all or part of distance of swimming that realizes in the foregoing description method, be to instruct relevant hardware to finish by computer program, described program can be stored in the computer read/write memory medium, this program can comprise the distance of swimming as the embodiment of above-mentioned each side method when carrying out.Wherein, described storage medium can be magnetic disc, CD, read-only storage memory body (Read-Only Memory, ROM) or at random store memory body (Random Access Memory, RAM) etc.
Above disclosed only is a kind of preferred embodiment of the present invention, certainly can not limit the present invention's interest field with this, one of ordinary skill in the art will appreciate that all or part of distance of swimming that realizes the foregoing description, and, still belong to the scope that invention is contained according to the equivalent variations that claim of the present invention is done.

Claims (10)

1. the compression method of a film thumbnail is characterized in that, comprising:
The film thumbnail is carried out lossy compression method, obtain the film thumbnail of particular number of bits;
Film thumbnail to described particular number of bits carries out Run-Length Coding;
Film thumbnail behind the Run-Length Coding is carried out lossless compress, obtain compressed picture.
2. the method for claim 1 is characterized in that, described film thumbnail is 24 bmp bitmaps of rgb format.
3. method as claimed in claim 2 is characterized in that, described the film thumbnail is carried out lossy compression method, obtains the film thumbnail of particular number of bits, comprising:
For 24 bmp bitmaps of all rgb formats of film are created unified palettes and unified header file;
Adopt the lossy compression method algorithm of logic-based computing, the pixel of 24 bmp bitmaps of each rgb format is compressed, obtain 16 bmp bitmaps of rgb format.
4. method as claimed in claim 3 is characterized in that, the film thumbnail of described particular number of bits is carried out Run-Length Coding, comprising:
Adopt the matrix stores mode to store 16 bmp bitmaps of all rgb formats of film;
16 bmp bitmaps to the rgb format of described matrix stores carry out the scanning of Z word;
According to Z word scanning result, 16 bmp bitmaps of the rgb format of described matrix stores are carried out Run-Length Coding.
5. method as claimed in claim 4 is characterized in that, described film thumbnail behind the Run-Length Coding is carried out lossless compress, obtains compressed picture, comprising:
According to the film thumbnail behind the Run-Length Coding, bilateral scanning sliding window;
Judge whether comprise in the described sliding window with described Run-Length Coding after the character string that is complementary of film thumbnail, if judged result is for being, export five metasymbol groups as compressed picture, and the length of long character string that described sliding window slides backward coupling is added 1 character; If judged result is exported the binary symbols as compressed picture for not, and described sliding window is slided backward 1 character;
Repeat above-mentioned steps, all compress until all film thumbnails and finish;
Wherein, described five metasymbol groups comprise: skew off, maximum matching length len, next character c in coding maker position bit, direction flag dir, the window;
Described binary symbols comprises: coding maker position bit and current character e.
6. method as claimed in claim 5 is characterized in that, described off adopts block code, and described len adopts prefix code.
7. a compression set is characterized in that, comprising:
The lossy compression method module is used for the film thumbnail is carried out lossy compression method, obtains the film thumbnail of particular number of bits;
The Run-Length Coding module, the film thumbnail that is used for particular number of bits that described lossy compression method module is obtained carries out Run-Length Coding;
The lossless compress module is used for the film thumbnail behind the described Run-Length Coding module coding is carried out lossless compress, obtains compressed picture.
8. compression set as claimed in claim 7 is characterized in that, described film thumbnail is 24 bmp bitmaps of rgb format, and described lossy compression method module comprises:
Creating unit is used to 24 bmp bitmaps of all rgb formats of film to create unified palette and unified header file;
The lossy compression method unit is used to adopt the lossy compression method algorithm of logic-based computing, and the pixel of 24 bmp bitmaps of each rgb format is compressed, and obtains 16 bmp bitmaps of rgb format.
9. compression set as claimed in claim 8 is characterized in that, described Run-Length Coding module comprises:
Memory cell, 16 bmp bitmaps of all rgb formats that are used to adopt the matrix stores mode to store film;
Scanning element is used for 16 bmp bitmaps of the rgb format of described cell stores are carried out the scanning of Z word;
The Run-Length Coding unit is used for the Z word scanning result according to described scanning element, and 16 bmp bitmaps of the rgb format of described matrix stores are carried out Run-Length Coding.
10. compression set as claimed in claim 9 is characterized in that, described lossless compress module comprises:
The bilateral scanning unit is used for according to the film thumbnail behind the Run-Length Coding, bilateral scanning sliding window;
Judging unit, the described sliding window that is used for judging described bilateral scanning unit scan whether comprise with described Run-Length Coding after the character string that is complementary of film thumbnail;
Lossless compression unit, be used for when described judgment unit judges result when being, export five metasymbol groups as compressed picture, and the length of long character string that described sliding window slides backward coupling added 1 character; When described judgment unit judges result for not the time, output binary symbols is as compressed picture, and described sliding window is slided backward 1 character;
Wherein, described five metasymbol groups comprise: skew off, maximum matching length len, next character c in coding maker position bit, direction flag dir, the window;
Described binary symbols comprises: coding maker position bit and current character e.
CN 201110035631 2011-02-10 2011-02-10 Method and device for compressing film thumbnails Active CN102088604B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110035631 CN102088604B (en) 2011-02-10 2011-02-10 Method and device for compressing film thumbnails

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201110035631 CN102088604B (en) 2011-02-10 2011-02-10 Method and device for compressing film thumbnails

Publications (2)

Publication Number Publication Date
CN102088604A true CN102088604A (en) 2011-06-08
CN102088604B CN102088604B (en) 2013-06-26

Family

ID=44100179

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110035631 Active CN102088604B (en) 2011-02-10 2011-02-10 Method and device for compressing film thumbnails

Country Status (1)

Country Link
CN (1) CN102088604B (en)

Cited By (19)

* Cited by examiner, † Cited by third party
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
CN104751794A (en) * 2013-12-31 2015-07-01 乐金显示有限公司 Organic light emitting display device and driving method thereof
CN106850785A (en) * 2017-01-20 2017-06-13 济南浪潮高新科技投资发展有限公司 A kind of physical message system data compression transmitting method of use sliding window caching
CN107079151A (en) * 2014-09-26 2017-08-18 株式会社Kt Method and apparatus for handling vision signal
CN107196660A (en) * 2017-04-24 2017-09-22 南京数维康信息科技有限公司 Low power consumption data compression algorithm
CN107211148A (en) * 2015-02-10 2017-09-26 高通股份有限公司 The limitation of palette block size in video coding
CN107220028A (en) * 2017-05-24 2017-09-29 上海兆芯集成电路有限公司 Accelerate compression method and the device using the method
CN108111858A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of picture compression method and device
CN110336999A (en) * 2013-12-18 2019-10-15 寰发股份有限公司 Utilize the method and apparatus of the encoded video data block of palette coding
US10477243B2 (en) 2015-01-29 2019-11-12 Kt Corporation Method and apparatus for predicting and restoring a video signal using palette entry and palette mode
US10477244B2 (en) 2015-01-29 2019-11-12 Kt Corporation Method and apparatus for predicting and restoring a video signal using palette entry and palette mode
US10477227B2 (en) 2015-01-15 2019-11-12 Kt Corporation Method and apparatus for predicting and restoring a video signal using palette entry and palette mode
US10477218B2 (en) 2014-10-20 2019-11-12 Kt Corporation Method and apparatus for predicting and restoring a video signal using palette entry
US10484713B2 (en) 2015-04-02 2019-11-19 Kt Corporation Method and device for predicting and restoring a video signal using palette entry and palette escape mode
CN110572664A (en) * 2019-08-14 2019-12-13 中国地质大学(武汉) Novel BMP image compression method and system
CN113438444A (en) * 2021-03-25 2021-09-24 贵州电网有限责任公司 Picture transmission and storage method and system
CN113656617A (en) * 2021-07-22 2021-11-16 南京信息职业技术学院 Picture lossless compression storage method and system and intelligent mobile terminal
CN116032294A (en) * 2023-02-23 2023-04-28 山东安之捷科技有限公司 Intelligent processing method for atmosphere monitoring data

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002069248A1 (en) * 2001-02-23 2002-09-06 Picsurf, Inc. Graphic image re-encoding and distribution system and method
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 王文延 Method for compressing and decompressing JPEG image without loss

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2002069248A1 (en) * 2001-02-23 2002-09-06 Picsurf, Inc. Graphic image re-encoding and distribution system and method
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 王文延 Method for compressing and decompressing JPEG image without loss

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《成都信息工程学院学报》 20080430 冷星星 等 高压缩低损耗图像编码算法研究 182-186 1-10 第23卷, 第2期 2 *

Cited By (26)

* Cited by examiner, † Cited by third party
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
CN110336999B (en) * 2013-12-18 2021-09-03 寰发股份有限公司 Method and apparatus for encoding a block of video data using palette coding
CN110336999A (en) * 2013-12-18 2019-10-15 寰发股份有限公司 Utilize the method and apparatus of the encoded video data block of palette coding
CN104751794A (en) * 2013-12-31 2015-07-01 乐金显示有限公司 Organic light emitting display device and driving method thereof
US9966035B2 (en) 2013-12-31 2018-05-08 Lg Display Co., Ltd. Organic light emitting display device and driving method thereof
CN107079151A (en) * 2014-09-26 2017-08-18 株式会社Kt Method and apparatus for handling vision signal
CN107079151B (en) * 2014-09-26 2020-06-05 株式会社Kt Method and apparatus for processing video signal
US10469870B2 (en) 2014-09-26 2019-11-05 Kt Corporation Method and apparatus for predicting and restoring a video signal using palette entry
US10477218B2 (en) 2014-10-20 2019-11-12 Kt Corporation Method and apparatus for predicting and restoring a video signal using palette entry
US10477227B2 (en) 2015-01-15 2019-11-12 Kt Corporation Method and apparatus for predicting and restoring a video signal using palette entry and palette mode
US10477244B2 (en) 2015-01-29 2019-11-12 Kt Corporation Method and apparatus for predicting and restoring a video signal using palette entry and palette mode
US10477243B2 (en) 2015-01-29 2019-11-12 Kt Corporation Method and apparatus for predicting and restoring a video signal using palette entry and palette mode
CN107211148A (en) * 2015-02-10 2017-09-26 高通股份有限公司 The limitation of palette block size in video coding
CN107211148B (en) * 2015-02-10 2020-08-04 高通股份有限公司 Palette block size limitation in video coding
US10484713B2 (en) 2015-04-02 2019-11-19 Kt Corporation Method and device for predicting and restoring a video signal using palette entry and palette escape mode
CN108111858A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of 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
CN107220028A (en) * 2017-05-24 2017-09-29 上海兆芯集成电路有限公司 Accelerate compression method and the device using the method
CN107220028B (en) * 2017-05-24 2020-05-29 上海兆芯集成电路有限公司 Accelerated compression method and apparatus using the same
CN110572664A (en) * 2019-08-14 2019-12-13 中国地质大学(武汉) Novel BMP image compression method and system
CN113438444A (en) * 2021-03-25 2021-09-24 贵州电网有限责任公司 Picture transmission and storage 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 南京信息职业技术学院 Picture lossless compression storage method and system and intelligent mobile terminal
CN116032294A (en) * 2023-02-23 2023-04-28 山东安之捷科技有限公司 Intelligent processing method for atmosphere monitoring data

Also Published As

Publication number Publication date
CN102088604B (en) 2013-06-26

Similar Documents

Publication Publication Date Title
CN102088604B (en) Method and device for compressing film thumbnails
US9787321B1 (en) Point cloud data compression using a space-filling curve
WO2019111004A1 (en) Methods and apparatuses for encoding and decoding a bytestream
US8285062B2 (en) Method for improving the performance of embedded graphics coding
CN110728725B (en) Hardware-friendly real-time system-oriented lossless texture compression method
US6683978B1 (en) Fixed-rate block-based image compression with inferred pixel values
CN106202213B (en) FPGA binary file compression and decompression method and device
CN103067022A (en) Nondestructive compressing method, uncompressing method, compressing device and uncompressing device for integer data
KR20200038171A (en) Methods of variable rate compression and decompression of image data in image pipeline of graphics processing system
CN115866287B (en) Efficient data transmission method for intelligent campus management platform
CN113170140A (en) Bit plane encoding of data arrays
Saravanan et al. Enhancing efficiency of huffman coding using Lempel Ziv coding for image compression
CN102970544A (en) JPEG (Joint Photographic Experts Group) encoding and decoding method and JPEG encoding and decoding system
Birajdar et al. Image compression using run length encoding and its optimisation
CN104575427A (en) High-compression-ratio lossless image compression method suitable for embedded system decoding
CN101511025A (en) Method and apparatus for compressing and decompressing image
CN102263946A (en) Techniques for storing and retrieving pixel data
CN110971904A (en) Control method for image compression
CN110191341B (en) Depth data coding method and decoding method
CN105245889B (en) A kind of reference frame compression method based on stratified sampling
Barman et al. Improved LZW compression technique using difference method
US10283094B1 (en) Run-length compression and decompression of media tiles
CN108184113B (en) Image compression coding method and system based on inter-image reference
US10003808B2 (en) Apparatus and method for encoding
US6433707B1 (en) Universal lossless compressor for digitized analog data

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.