Embodiment 1
According to embodiments of the present invention, a kind of embodiment of the compression method of image is provided, it should be noted that in attached drawing
Process the step of illustrating can execute in a computer system such as a set of computer executable instructions, although also,
Logical order is shown in flow charts, but in some cases, can be executed with the sequence for being different from herein it is shown or
The step of description.
Fig. 1 is the flow chart of the compression method of image according to an embodiment of the present invention, as shown in Figure 1, this method includes such as
Lower step:
Current frame image is carried out piecemeal according to the first presetted pixel specification, and obtained belonging to each piece by step S102
Type.
Specifically, above-mentioned current frame image can be any one frame image in video image, in a kind of optional implementation
In example, type belonging to each piece may include: zero motion vector block, global motion vector, character block and picture block.
Step S104, the type according to belonging to each piece mark each piece of location in the current frame image
Note, obtains the block type index map of the current frame image.
In above-mentioned steps, each piece of position is marked with the type of block, to obtain block type index map.
Step S106 carries out piecemeal to the block type index map according to the second presetted pixel specification, and according to described piece
Whether the determined property of block carries out piecemeal again to the block type index map after piecemeal in types index figure.
Specifically, in above-mentioned steps, above-mentioned second presetted pixel specification less than the first presetted pixel specification, above-mentioned piece
Attribute may include the attributes such as Coding cost function of the type of block, block.According to the determined property of block whether to the block after piecemeal
The principle that block in types index figure carries out piecemeal again can be Coding cost minimum.With zero motion vector block and global motion
For vector block, if the identical zero motion vector block of index value and global motion vector block respectively flock together, Duo Ge little
The auxiliary information of a bulk can be used to indicate in the auxiliary information of block, reduces the auxiliary information of transmission, therefore can pass through
Index value determines whether to block type to be that the block of zero motion vector block and global motion vector block continues piecemeal, then with text
For block and picture block, if character block and picture block respectively flock together, the correlation in bigger region is possible to more have
Conducive to text and coding of graphics, therefore can determine whether to be character block or image block to block type by Coding cost function
Block continue piecemeal.
Herein it should be noted that above-mentioned steps are to carry out the process of adaptive piecemeal to image, through the above steps
The block of various sizes is obtained, when continuing coding, various sizes of piece obtained to last piecemeal is encoded.
Step S108, type belonging to each piece is to described according to described in block type index map after the piecemeal again
Current frame image is encoded, and the compressed bit stream of described image is obtained.
In above-mentioned steps, obtain after piecemeal again in block type index map after type belonging to each piece, according to each
Type belonging to block carries out corresponding coding to various sizes of piece obtained after piecemeal again in current frame image.
As a kind of optional embodiment, available reference frame image, and by each frame in screen video be divided into m ×
The block of n, judge each piece described in type, including one of following four seed type: zero motion vector block, global motion vector
Block, character block and picture block.Then the width block type index map for indicating block type is generated, and true using quaternary tree and coding
Cost value carries out adaptive piecemeal to block type index map, finally judges its type and using corresponding to each various sizes of piece
Compression method compressed.
Herein it should be noted that due to image neighborhood pixels similitude, usually poly- heap the block of four seed types occurs.This
The characteristic that kind same kind block aggregation occurs actually is more conducive to compressed encoding.If zero motion vector block and global motion vector
Block respectively flocks together, and the auxiliary information of a bulk can be used to indicate in the auxiliary information of multiple fritters.If text
Block and picture block respectively flock together, and the correlation that can use bigger region is more advantageous to text and coding of graphics.It is above-mentioned
Scheme carries out adaptive piecemeal aiming at the characteristic of four each self aggregations of seed type block in screen video image, to make various types of
The block of type realizes the compressed encoding of higher efficiency.
From the foregoing, it will be observed that current frame image is carried out piecemeal according to the first presetted pixel specification by the application above-mentioned steps, and obtain
Type belonging to taking each piece, the type according to belonging to each piece carry out the location of each piece in the current frame image
Label obtains the block type index map of the current frame image, according to the second presetted pixel specification to the block type index map
Piecemeal is carried out, and whether the block type index map after piecemeal is carried out again according to the determined property of block in the block type index map
Secondary piecemeal, type belonging to each piece is to the current frame image according to described in block type index map after the piecemeal again
It is encoded, obtains the compressed bit stream of described image.A variety of pieces of characteristic and contiguous block class in image is utilized in above scheme
The characteristics of type similitude, reduces the auxiliary information generated in cataloged procedure, to solve video image in the prior art
The technical issues of being compressed in the demand for not being able to satisfy bandwidth in transmission process, and in the case where limited bandwidth resources, it improves
Restore the quality of image, preferably the compression of realization screen video image.
Optionally, according to the above embodiments of the present application, described piece of type include: zero motion vector block, global motion to
Gauge block, character block and image block.
Optionally, according to the above embodiments of the present application, step S102, obtain each piece belonging to type, comprising:
The current frame image is compared with reference frame image, obtains the fortune of the current frame image by step S1021
Dynamic characteristic.
In above-mentioned steps, reference frame image is determined according to image transmitting task, can be upper the one of current frame image
Frame image is also possible to the background image determined in image transmitting process.
Step S1023, according to the kinetic characteristic of the current frame image determine in the current frame image zero move to
Gauge block and global motion vector block.
In an alternative embodiment, Fig. 2 is the schematic diagram of reference frame image in the example, Fig. 3 be in the example when
The schematic diagram of prior image frame, Fig. 4 are the block type index maps of the current frame image in Fig. 3, and it is figure that square marks are used in Fig. 4
The 3 zero motion vector block relative to Fig. 2.
Step S1025 is determined in the current frame image according to the characteristic of writings and image in the current frame image
Character block and image block.
It still in the above-described embodiments, the use of circles mark is global motion vector block of the Fig. 3 relative to Fig. 2, using
Warning triangle is the character block in Fig. 3, the use of five-pointed star label is the picture block in Fig. 3.
Optionally, according to the above embodiments of the present application, step S104, the type according to belonging to each piece is to the present frame
Each piece of location is marked in image, obtains the block type index map of the current frame image, comprising:
Step S1041 determines each type of piece of corresponding mark.
It in an alternative embodiment, include global motion vector block, zero motion vector block, character block with the type of block
For image block, it can determine zero motion vector block labeled as 0, global motion vector block is labeled as 1, by character block mark
2 are denoted as, picture block is labeled as 3.
Step S1043, according to the corresponding mark of each piece of the type matching.
Step S1045 indicates described each piece using the corresponding mark of each piece of the type matching, to obtain
State block type index map.
Above-mentioned steps are determining each piece of type, and after the corresponding mark of the type for obtaining each piece, according to each piece
Type match corresponding mark, to obtain the block type index map of current frame image.
Optionally, according to the above embodiments of the present application, in the block type index map attribute of block include: index value and/
Or Coding cost functional value, step S106, according to the determined property of block in the block type index map whether to the block type
Index map carries out piecemeal again, comprising:
Step S1061 is the zero motion vector block or the global motion vector in the block of the block type index map
In the case where block, judged whether to carry out piecemeal again to the block type index map according to index value.
Step S1063, in the case where the block of the block type index map is the character block or described image block, according to
Index value and Coding cost functional value judge whether to carry out piecemeal again to the block type index map.
Optionally, according to the above embodiments of the present application, step S1061 is zero movement in the block of the block type index map
In the case where vector block or global motion vector block, judge whether to divide the block type index map again according to index value
Block, comprising:
Step S1061a, the case where the block of the block type index map is zero motion vector block and global motion vector block
Under, if having different index values in the block of the block type index map, continue piecemeal, until each rope in block
It is all identical to draw value.
Step S1061b, if each index value is identical in the block of the block type index map, without piecemeal.
Herein it should be noted that since zero motion vector block and global motion vector block are to be contained in reference frame image
In include pixel, therefore during coding only transmission enable motion vector block label and global motion vector block it is auxiliary
Supplementary information, without transmitting the particular content of zero motion vector block and global motion vector block.
Since if zero motion vector block and global motion vector block respectively flocked together, the auxiliary information of multiple fritters
The auxiliary information of a bulk can be used to indicate, therefore, above scheme is to zero motion vector block and global motion vector block
Piecemeal is carried out, until the pixel in each piece is identical, thus in an encoding process being capable of one bulk of composition identical to pixel
Pixel indicated by the auxiliary information of bulk, have higher code efficiency.
Optionally, according to the above embodiments of the present application, step S1063 is the text in the block of the block type index map
In the case where block or image block, judge whether to carry out the block type index map according to index value and Coding cost functional value
Piecemeal again, comprising:
Step S1063a, in the case where the block of the block type index map is the character block or described image block, such as
There is different index values in the block of block type index map described in fruit, then continue piecemeal, until each index value in block
It is all identical.
Step S1063b after each index value is identical in determining block, continues identical piece of each index value
First time piecemeal is carried out, and obtains the Coding cost functional value and first time of identical piece of corresponding original image of each index value
The Coding cost functional value of the corresponding original image of block after piecemeal.
Step S1063c, if the Coding cost functional value of identical piece of corresponding original image of each index value is small
The summation of the Coding cost functional value of the corresponding original image of block after first time piecemeal, then it is identical to retain each index value
Block no longer carries out piecemeal.
Step S1063d, if the Coding cost functional value of identical piece of corresponding original image of each index value is big
The summation of the Coding cost functional value of the corresponding original image of block after first time piecemeal, then continue to the block after first time piecemeal
Carry out second of piecemeal, until piecemeal before Coding cost functional value be less than piecemeal after multiple pieces Coding cost functional value it is total
With.
Above-mentioned steps are after piecemeal obtains the identical character block of pixel and image block in each piece, according to cost letter
Number judge whether to carry out piecemeal again again, judgement foundation be the previous monolith of piecemeal fgs encoder cost function and piecemeal after
The comparison result of the sum of every piece of Coding cost function, take the lesser mode of Coding cost function determine whether carry out piecemeal,
To improve the code efficiency of character block and picture block.
From the foregoing, it will be observed that the step blocking process of above-mentioned piecemeal again similar can call a recursive function, and stop adjusting
Condition is following three one of any: there was only a seed type in each piece, all types are zero motion vector block in this block
Though all types are character block or picture block in global motion vector block, this block, compression performance is more after piecemeal again
Poor (i.e. cost function is higher).
The case where above scheme adequately considers the blocks of four seed types usually poly- heap occurs, if zero motion vector block
It respectively flocks together with global motion vector block, the auxiliary information that a bulk can be used in the auxiliary information of multiple fritters is come
Indicate, if character block and picture block respectively flock together, can use bigger region correlation be more advantageous to text and
Coding of graphics so that the characteristic for four each self aggregations of seed type block in screen video image carries out adaptive piecemeal, and then makes
The various types of pieces of compressed encodings for realizing higher efficiency.
Optionally, according to the above embodiments of the present application, step S108, according in block type index map after the piecemeal again
Type belonging to each of description piece encodes the current frame image, obtains the compressed bit stream of described image, comprising:
The zero motion vector block and the global motion vector block is marked in step S1081, and by the overall situation
Motion vector block is as assistance information transmission to decoding end.
In above-mentioned steps, since zero motion vector block in current frame image is not have for reference frame image
There is the part of variation, therefore only needs that null vector moving mass is marked, it only will label during decoding restores image
It is that zero motion vector block is and is restored with reference frame image, since global motion vector block is deposited for reference frame image
But different for it part, it is therefore desirable to transmit auxiliary information so that receiving end restores global motion vector block to corresponding
Position.
Step S1083 carries out block coding to the character block and described image block according to the result of final piecemeal.
The coding of character block and image block is carried out according to final piecemeal result in above-mentioned steps, due to final piecemeal
It as a result is actually for the smallest piecemeal of Coding cost function as a result, therefore being carried out according to above-mentioned steps to character block and image block
Coding can be improved code efficiency, the bandwidth used when reducing image coding.
The compression method of above-mentioned image is described below with a kind of alternative embodiment, Fig. 5 is according to an embodiment of the present invention
A kind of flow chart of the compression method of image, which may include following steps:
Current frame image is divided into the block of M*N by S51.
Current frame image (such as Fig. 3) and its reference frame image (such as Fig. 4) in screen video are obtained, and is divided into 8 × 8
Block.
S52, the type of decision block.
It is classified as zero motion vector block, global motion vector block and other pieces using kinetic characteristic, utilizes text and figure
The characteristic of piece is divided into character block and picture block for other pieces.
S53 generates block type index map.
Different digital representations can be used in each piece of type, and such as zero motion vector block is labeled as 0 and uses square structure
It indicates, global motion vector block is labeled as 1 and uses circle representation, and character block is labeled as 2 and uses inverted triangle structure table
Show, picture block is labeled as 3 and uses five-pointed star representation, to generate the piece image for indicating block type, i.e. block type rope
Draw image, having a size of (W/8) × (H/8).Fig. 4 is then the block type thumbnail of Fig. 3.
S54 carries out adaptive classification to block.
Obtained block type thumbnail is divided into 8 × 8 block, as shown in figure 4, if index value in current 8 × 8 pieces
Identical, that is, the pattern indicated is identical, and is zero motion vector block or global motion vector block, then this 8 × 8 block not into
Row further decomposes.
If the index value in current 8 × 8 pieces is identical, that is, the pattern indicated is not identical and is character block or picture
Block, need first by this 8 × 8 block is divided into four 4 × 4 blocks, calculate separately corresponding position pixel in 8 × 8 pieces of corresponding original images
Coding cost function value and four 4 × 4 blocks correspond to the cost function value of the coding of corresponding position pixel in original image
Sum size, by current 8 × 8 if the Coding cost function in one big region is greater than the Coding cost function of four zonules
Block is divided into four 4 × 4 blocks, otherwise still retains current 8 × 8 block.The block for such as needing to be decomposed into four 4 × 4, then need to use
Same method judges whether to need to be further broken into 2 × 2 block, until the size of block reaches 1 × 1.
If the index value in current 8 × 8 pieces is not exactly the same, need now to be broken down into four 4 × 4 blocks, if
The index value in 4 × 4 block after decomposition is still different, needs to be further divided into the block for four 2 × 2, if 4 × 4 after decomposing
Block in index value it is identical, then processing method is the same as above-mentioned two step.
All classification informations in cataloged procedure are stored using piecemeal quaternary tree, and the bottom of quaternary tree needs
Store the type information of block.In an alternative embodiment, can indicate whether current block continues point using 0 and 1
Block uses 0 (zero motion vector block), 1 (global motion vector block), 2 (character blocks) and 3 (picture blocks) after being identified as 0 block
It indicates the type of block, 1 is expressed as if continuing piecemeal, be expressed as 0 if ending piecemeal, in some block be expressed as 0
In the case of, it is determined that the block no longer carries out piecemeal, therefore is expressed as 0 block as the bottom of the block, it is therefore desirable to record the block
Type.For example, some block is identified as 1, therefore it can also continue to divide, four blocks are expressed as 1,0 (1), 0 after segmentation
(3), 0 (2), wherein be expressed as 1 block and also need to continue piecemeal, the block for being expressed as 0 then ends piecemeal, and is respectively global fortune
Trend gauge block, picture block and character block.
S55, zero motion vector block coding.
S56, global motion vector block coding.
S57, text block coding.
S58, picture block coding.
After adaptive piecemeal, encoded according to the type of block.Zero motion vector block and global motion vector block only need
Simple marking, global motion vector value is as assistance information transmission to decoding end.Character block and picture block can distinguish monolith
It is encoded, substantially increases coding efficiency.
S59 carries out code stream organization to the compressed bit stream that a variety of encryption algorithms obtain.
S510 exports the compressed bit stream of image.
Decoding end is decoded and shows after receiving the compressed bit stream of image, to the code stream of different type block.
Fig. 6 is a kind of optional screen video codec architecture diagram according to an embodiment of the present invention, as shown in connection with fig. 6,
In an alternative embodiment, portable equipment (such as: mobile phone, tablet computer etc.) is true by the adaptive piecemeal module of block type
Determine the block type index map of image, then adaptive piecemeal is carried out to the block in block type index map, obtains zero motion vector block, complete
Office's motion vector block, character block and picture block, carry out motion vector block to zero motion vector block and global motion vector block respectively
Coding carries out text block coding to character block, after carrying out picture block coding to picture block, carries out code stream by code stream organization module
Tissue, and display apparatus end is sent to by sending module, display apparatus end receives the compression of image by receiving module
Code stream, and by code stream split module carry out code stream fractionation, to the code stream after fractionation pass through respectively motion vector block decoder module,
Character block decoder module and picture block decoder module are decoded, and are shown finally by decoding frame display module.
Embodiment 2
According to embodiments of the present invention, a kind of embodiment of the compression set of image is provided, Fig. 7 is to implement according to the present invention
The schematic diagram of the compression set of the image of example, as shown in fig. 7, the device includes:
Block type judgment module 70 for current frame image to be carried out piecemeal according to the first presetted pixel specification, and obtains
Type belonging to each piece.
Mark module 72 carries out the location of each piece in current frame image for the type according to belonging to each piece
Label, obtains the block type index map of current frame image.
Adaptive piecemeal module 74, for carrying out piecemeal, and root to block type index map according to the second presetted pixel specification
Whether piecemeal again is carried out to the block type index map after piecemeal according to the determined property of block in block type index map.
Coding module 76, for type belonging to each piece according to described in block type index map after piecemeal again to working as
Prior image frame is encoded, and the compressed bit stream of image is obtained.
Optionally, according to the above embodiments of the present application, the type of block include: zero motion vector block, global motion vector block,
Character block and image block.
Optionally, according to the above embodiments of the present application, block type judgment module includes:
It compares submodule and obtains the movement of current frame image for current frame image to be compared with reference frame image
Characteristic.
First determine submodule, for the kinetic characteristic according to current frame image determine in current frame image zero move to
Gauge block and global motion vector block.
Second determines submodule, for being determined in current frame image according to the characteristic of writings and image in current frame image
Character block and image block.
Optionally, according to the above embodiments of the present application, mark module includes:
Third determines submodule, for determining each type of piece of corresponding mark.
Submodule is generated, for according to each piece of the corresponding mark of type matching.
4th determines submodule, and the corresponding mark for the type matching using each piece indicates the picture in each piece
Element, to obtain block type index map.
Optionally, according to the above embodiments of the present application, the attribute of block includes: index value and/or volume in block type index map
Code cost function value, adaptive piecemeal module include:
First judging submodule, for being zero motion vector block or global motion vector block in the block of block type index map
In the case of, judged whether to carry out piecemeal again to block type index map according to index value.
Second judgment submodule, for the block of block type index map be character block or image block in the case where, according to rope
Draw value and Coding cost functional value judges whether to carry out piecemeal again to block type index map.
Optionally, according to the above embodiments of the present application, the first judging submodule includes:
First blocking unit, in the feelings that the block of block type index map is zero motion vector block and global motion vector block
Under condition, if having different index values in the block of block type index map, continue piecemeal, until each index in block
It is worth all identical;If each index value is identical in the block of block type index map, without piecemeal.
Optionally, according to the above embodiments of the present application, second judgment submodule includes:
Second blocking unit, for the block of block type index map be character block or image block in the case where, such as fruit block class
There is different index values in the block of type index map, then continue piecemeal, until each index value in block is identical;
Third blocking unit, for index value each in determining block it is identical after, it is identical to each index value
Block continues first time piecemeal, and obtain identical piece of corresponding original image of each index value Coding cost functional value and
The Coding cost functional value of the corresponding original image of block after first time piecemeal;
Stick unit, if the Coding cost functional value for identical piece of corresponding original image of each index value is less than
The summation of the Coding cost functional value of the corresponding original image of block after first time piecemeal, then retain identical piece of each index value
No longer carry out piecemeal;
4th blocking unit, if the Coding cost functional value for identical piece of corresponding original image of each index value
Greater than the summation of the Coding cost functional value of the corresponding original image of block after first time piecemeal, then continue to after first time piecemeal
Block carries out second of piecemeal, until the Coding cost functional value before piecemeal is less than multiple pieces of Coding cost functional value after piecemeal
Summation.
Optionally, according to the above embodiments of the present application, coding module includes:
Sending module, for zero motion vector block and global motion vector block to be marked, and by global motion vector
Block is as assistance information transmission to decoding end;
Encoding submodule, for carrying out block coding to character block and image block according to the result of final piecemeal.
Specifically, above-mentioned encoding submodule may include motion vector block coding module, to zero motion vector block and entirely
Office's motion vector block encoded, text block coding module, to be encoded to character block and picture block coding module, with
Picture block is encoded.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
In the above embodiment of the invention, it all emphasizes particularly on different fields to the description of each embodiment, does not have in some embodiment
The part of detailed description, reference can be made to the related descriptions of other embodiments.
In several embodiments provided herein, it should be understood that disclosed technology contents can pass through others
Mode is realized.Wherein, the apparatus embodiments described above are merely exemplary, such as the division of the unit, Ke Yiwei
A kind of logical function partition, there may be another division manner in actual implementation, for example, multiple units or components can combine or
Person is desirably integrated into another system, or some features can be ignored or not executed.Another point, shown or discussed is mutual
Between coupling, direct-coupling or communication connection can be through some interfaces, the INDIRECT COUPLING or communication link of unit or module
It connects, can be electrical or other forms.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
On unit.It can some or all of the units may be selected to achieve the purpose of the solution of this embodiment according to the actual needs.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially
The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words
It embodies, which is stored in a storage medium, including some instructions are used so that a computer
Equipment (can for personal computer, server or network equipment etc.) execute each embodiment the method for the present invention whole or
Part steps.And storage medium above-mentioned includes: that USB flash disk, read-only memory (ROM, Read-Only Memory), arbitrary access are deposited
Reservoir (RAM, Random Access Memory), mobile hard disk, magnetic or disk etc. be various to can store program code
Medium.
The above is only a preferred embodiment of the present invention, it is noted that for the ordinary skill people of the art
For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered
It is considered as protection scope of the present invention.