A kind of irregular division Video Encoding Mode system of selection, device
Technical field
The present invention relates to field of video encoding, more particularly to it is a kind of suitable for the irregular Video Encoding Mode selection for dividing
Method and apparatus.
Background technology
In field of video encoding, it is important ingredient in Video coding that block is divided.New video in prior art
Coding techniques, such as H264 etc. are all, using based on tree-shaped block dividing mode, macro block to be exactly finely divided into multiple rectangular blocks.
Although this piece of dividing mode is compared the code efficiencies such as old video encoding standard h263 and has been greatly improved, this
The regular block division methods for planting rectangle can not represent the irregular geometrical property of objects in images well.According to prior art
Block dividing mode, the edge of encoded video objects in images needs to use substantial amounts of bit number, and this results in the image after coding
Than more serious, object edge is unsmooth, greatly reduces the subjective and objective efficiency of Video coding for the overcompression phenomenon of object edge.This
Individual problem is more projected in Video Compression at Low Bit-rate application.Therefore need a kind of more preferable block division methods to improve volume
The overcompression phenomenon at objects in images edge after code so that the image object edge after coding is more smoothed, is further lifted and is compiled
The subjective effect of code.
The content of the invention
The purpose of the embodiment of the present invention is to propose a kind of Video Encoding Mode system of selection suitable for irregular division
With device, it is intended to solve the overcompression phenomenon at the image object edge after prior art coding than more serious, object edge injustice
It is sliding, greatly reduce the problem of the subjective and objective efficiency of Video coding.
The present invention provides a kind of suitable for the irregular Video Encoding Mode system of selection for dividing, and described method includes:
Preset first to the tenth piece of division coding mode;
The edge of image in current macro is extracted using arithmetic operators, and obtains current according to the edge of described image
The gradient information of view data in macro block;
Described image data binaryzation result is arranged according to the gradient information;
Coding mode is divided according to the view data binaryzation result and selection current macro block of the current macro;
Described current macro block is divided into coding mode with the rectangular block partition mode output of routine to encoder modes
In selecting module, the optimum block for selecting current macro divides coding mode.
Wherein, described " first to the tenth piece of division coding mode " is specially:
First piece divides coding mode for the most left first row midpoint of connection macro block with the macro block most upper right corner into an oblique line, grand
Block is divided into two parts by this oblique line;
Second piece divides coding mode for the connection macro block most upper left corner with the most right first row midpoint of macro block into an oblique line, grand
Block is divided into two parts by this oblique line;
3rd piece divides coding mode for the most left first row midpoint of connection macro block with macro block last cell into one article of oblique line, grand
Block is divided into two parts by this oblique line;
4th piece divides coding mode for the connection macro block most lower left corner with the most right first row midpoint of macro block into one article of oblique line, grand
Block is divided into two parts by this oblique line;
5th piece divides coding mode and most goes up the first row midpoint and macro block most lower left corner into one article of oblique line for connection macro block, grand
Block is divided into two parts by this oblique line;
6th piece divides coding mode and most goes up the first row midpoint and macro block last cell into one article of oblique line for connection macro block, grand
Block is divided into two parts by this oblique line;
7th piece divides coding mode and most descends the first row midpoint and macro block most upper left corner into one article of oblique line for connection macro block, grand
Block is divided into two parts by this oblique line;
8th piece divides coding mode and most descends the first row midpoint and macro block most upper right corner into one article of oblique line for connection macro block, grand
Block is divided into two parts by this oblique line;
9th piece divides coding mode for the connection macro block most lower left corner with the macro block most upper right corner into one article of oblique line, and macro block is by this
Oblique line is divided into two parts;
Tenth piece divides coding mode for the connection macro block most upper left corner with macro block last cell into one article of oblique line, and macro block is by this
Oblique line is divided into two parts.
The present invention also provides a kind of suitable for the irregular Video Encoding Mode selecting device for dividing, described device bag
Include, preset unit, gradient information acquiring unit, the first judging unit, the second judging unit, optimization model determining unit;
Preset unit, for preset first to the tenth piece of division coding mode;
Gradient information acquiring unit, for the edge using image in arithmetic operators extraction current macro, and according to
The edge of described image obtains the gradient information of view data in current macro;
First judging unit, for arranging described image data binaryzation result according to the gradient information;
Second judging unit, for the view data binaryzation result according to the current macro and selection current macro block
Divide coding mode;
Optimization model determining unit, is divided with the rectangular block of routine for described current macro block is divided coding mode
Pattern is exported in encoder modes selecting module, and the optimum block for selecting current macro divides coding mode.
The present invention divides coding mode by preset different block, and macro block is divided and image border characteristic and surrounding
Adjacent macroblocks characteristic combines, and divides coding mode to carry out according to different blocks by current macro according to different situations respectively
Divide;Therefore the method for being provided by the present invention can effectively improve the overcompression phenomenon of object edge in encoded images,
Image object edge after coding is more smoothed, and effectively improves the subjective effect of coding.
Description of the drawings
Fig. 1 is the method flow diagram of the embodiment of the present invention 1;
Fig. 2 is first piece of division coding mode that the embodiment of the present invention 1 is provided;
Fig. 3 is second piece of division coding mode that the embodiment of the present invention 1 is provided;
Fig. 4 is the 3rd piece of division coding mode that the embodiment of the present invention 1 is provided;
Fig. 5 is the 4th piece of division coding mode that the embodiment of the present invention 1 is provided;
Fig. 6 is the 5th piece of division coding mode that the embodiment of the present invention 1 is provided;
Fig. 7 is the 6th piece of division coding mode that the embodiment of the present invention 1 is provided;
Fig. 8 is the 7th piece of division coding mode that the embodiment of the present invention 1 is provided;
Fig. 9 is the 8th piece of division coding mode that the embodiment of the present invention 1 is provided;
Figure 10 is the 9th piece of division coding mode that the embodiment of the present invention 1 is provided;
Figure 11 is the tenth piece of division coding mode that the embodiment of the present invention 1 is provided;
Figure 12 is the structure figure structure schematic representation of the embodiment of the present invention 2.
Specific embodiment
In order that the objects, technical solutions and advantages of the present invention become more apparent, it is below in conjunction with drawings and Examples, right
The present invention is further elaborated, and for convenience of description, illustrate only the part related to the embodiment of the present invention.Should manage
Solution, the specific embodiment that this place is described are used only for explaining the present invention, not to limit the present invention.
The present invention divides coding mode by preset different block, and macro block is divided and image border characteristic and surrounding
Adjacent macroblocks characteristic combines, and divides coding mode to carry out according to different blocks by current macro according to different situations respectively
Divide.
Embodiment one, the present invention provide a kind of irregular division Video Encoding Mode system of selection:Referring to Fig. 1, the enforcement
Example concrete grammar be:
Step 101:Preset first to the tenth piece of division coding mode;
Described first divides coding mode to the tenth piece and is respectively:
Referring to Fig. 2, first piece divides coding mode to connect the most left first row midpoint of macro block and the macro block most upper right corner into one
Bar oblique line, macro block are divided into two parts by this oblique line;
Referring to Fig. 3, second piece divides coding mode to connect the macro block most upper left corner and the most right first row midpoint of macro block into one
Bar oblique line, macro block are divided into two parts by this oblique line;
Referring to Fig. 4, the 3rd piece divides coding mode to connect the most left first row midpoint of macro block and macro block last cell into one
Bar oblique line, macro block are divided into two parts by this oblique line;
Referring to Fig. 5, the 4th piece divides coding mode to connect the macro block most lower left corner and the most right first row midpoint of macro block into one
Bar oblique line, macro block are divided into two parts by this oblique line;
Referring to Fig. 6, the 5th piece divides coding mode and most goes up the first row midpoint and macro block most lower left corner into one for connection macro block
Bar oblique line, macro block are divided into two parts by this oblique line;
Referring to Fig. 7, the 6th piece divides coding mode and most goes up the first row midpoint and macro block last cell into one for connection macro block
Bar oblique line, macro block are divided into two parts by this oblique line;
Referring to Fig. 8, the 7th piece divides coding mode and most descends the first row midpoint and macro block most upper left corner into one for connection macro block
Bar oblique line, macro block are divided into two parts by this oblique line;
Referring to Fig. 9, the 8th piece divides coding mode and most descends the first row midpoint and macro block most upper right corner into one for connection macro block
Bar oblique line, macro block are divided into two parts by this oblique line;
Referring to Figure 10, it is that the connection macro block most lower left corner and the macro block most upper right corner are oblique into one article that the 9th piece divides coding mode
Line, macro block are divided into two parts by this oblique line;
Referring to Figure 11, it is that the connection macro block most upper left corner and macro block last cell are oblique into one article that the tenth piece divides coding mode
Line, macro block are divided into two parts by this oblique line.
Step 102:The edge of image in current macro is extracted using arithmetic operators, and according to the side of described image
Edge obtains the gradient information G [i, j] of view data in current macro;
Step 103:Described image data binaryzation result is arranged according to the gradient information;
The step can be:Judge whether described gradient information binaryzation result t [i, j] is more than or equal to first threshold
T, if it is 1 then to arrange view data binaryzation result t [i, j], if otherwise arrange view data binaryzation result t [i,
J] for 0;
Step 104:Coding is divided according to the view data binaryzation result and selection current macro block of the current macro
Pattern;
The step can be:Whether view data binaryzation result t [i, j] and Smode for judging current macro is 0, if
It is that then current macro selects a kind of as current macro block division coding mode in conventional rectangular block partition mode;If otherwise
Preset first to the tenth piece divide coding mode in select it is a kind of current macro is divided, obtain current macro block draw
Lacing pattern;
Step 105:Described current macro block is divided into coding mode and conventional rectangular block partition mode output is arrived and compiled
In code device mode selection module, the optimum block for selecting current macro divides coding mode.
It is described at step 104 " to divide at preset first to the tenth piece and in coding mode, select a kind of to current grand
Block is divided, and is obtained current macro block and is divided coding mode " can be:
Whether the division methods for judging current macro upper left corner macro block are the three, the six, ten pieces of described division coding modes
In one kind, if then by current macro respectively according to described second, seven, ten block divide coding mode divide;
The block for finding second, seven, ten respectively divides the pixel that coding mode oblique line is passed through, and obtains the figure of the pixel
As the gradient information G [i, j] of data;Judge whether described gradient information G [i, j] is more than or equal to first threshold T, if then
It is 1 to arrange view data binaryzation result t [i, j], if it is 0 otherwise to arrange view data binaryzation result t [i, j];
Select described second, seven, ten block divide coding mode bend pass through view data binaryzation result t [i,
J] and the maximum blocks of Smode divide coding mode and divide coding mode as current macro block;
Or judge that whether the division methods of macro block directly over current macro are that described the seven, the eight, nine, ten pieces divide coding
One kind in pattern, if current macro is divided coding mode according to described the five, the six, nine, ten block respectively then dividing;
The block for finding the five, the six, nine, ten respectively divides the pixel that coding mode oblique line is passed through, and obtains the pixel
View data gradient information G [i, j];Judge whether described gradient information G [i, j] is more than or equal to first threshold T, if
It is that to arrange view data binaryzation result t [i, j] be 1, if otherwise arrange view data binaryzation result t [i, j] being
0;
Described five, the six, nine, ten block is selected to divide view data binaryzation result t that coding mode bend is passed through
[i, j] and Smode maximum block divides coding mode and divides coding mode as current macro block;
Or judge that whether the division methods of current macro left side macro block are that described second, four, nine, ten pieces divide coding moulds
One kind in formula, if current macro is divided coding mode according to described first and third, nine, ten block respectively then dividing;
The block for finding first and third, nine, ten respectively divides the pixel that coding mode oblique line is passed through, and obtains the pixel
View data gradient information G [i, j];Judge whether described gradient information G [i, j] is more than or equal to first threshold T, if
It is that to arrange view data binaryzation result t [i, j] be 1, if otherwise arrange view data binaryzation result t [i, j] being
0;
Described first and third, nine, ten block is selected to divide view data binaryzation result t that coding mode bend is passed through
[i, j] and Smode maximum block divides coding mode and divides coding mode as current macro block;
Or judge that whether the division methods of current macro upper right corner macro block are that described fourth, fifth, nine pieces divide coding moulds
One kind in formula, if current macro is divided coding mode according to described first, eight, nine block respectively then dividing;
The block for finding first, eight, nine respectively divides the pixel that coding mode oblique line is passed through, and obtains the figure of the pixel
As the gradient information G [i, j] of data;Judge whether described gradient information G [i, j] is more than or equal to first threshold T, if then
It is 1 to arrange view data binaryzation result t [i, j], if it is 0 otherwise to arrange view data binaryzation result t [i, j];
Select described first, eight, nine block divide coding mode bend pass through view data binaryzation result t [i,
J] and the maximum blocks of Smode divide coding mode and divide coding mode as current macro block;
Or current macro is divided into coding mode division according to described the first to ten block respectively;
The block for finding the first to ten respectively divides the pixel that coding mode oblique line is passed through, and obtains the image of the pixel
The gradient information G [i, j] of data;Judge whether described gradient information G [i, j] is more than or equal to first threshold T, if then setting
It is 1 to put view data binaryzation result t [i, j], if it is 0 otherwise to arrange view data binaryzation result t [i, j];
Described the first to ten block is selected to divide view data binaryzation result t [i, j] that coding mode bend is passed through
Coding mode is divided with Smode maximum block coding mode is divided as current macro block.
Step 105:Described optimal dividing pattern is merged into conventional rectangular block partition mode output to encoder modes
In selecting module, the optimum block for selecting current macro divides coding mode.
In embodiment 1 described in step 102, step 104 " obtain current macro in view data gradient information ",
" obtaining the gradient information of the view data of the pixel " method is specially:
G [i, i]=| f [i-1, j+1]+2f [i, j+1]+f [i+1, j+1]-f [i-1, j-1] -2f [i, j-1]-f [i+1,
j-1]|+|f[i-1,j-1]+2f[i-1,j]+f[i-1,j+1]-f[i+1,j-1]-2f[i+1,j]-f[i+1,j+1]|;
F [i, j] represents that the i-th row jth row pixel value in macro block, f [i+1, j+1] etc. are to represent pixel f [i, j] in original graph
Adjacent pixel values as in, G [i, j] represent the view data gradient information for calculating.
The embodiment of the present invention 1 divides coding mode by preset different block, and macro block is divided special with image border
Property and surrounding adjacent macroblocks characteristic combine, current macro is divided according to different block respectively by coding mould according to different situations
Formula is being divided;Therefore the method for being provided by the present invention can effectively improve the overvoltage of object edge in encoded images
Contracting phenomenon, the image object edge after coding are more smoothed, and effectively improve the subjective effect of coding.
Embodiment two, relative to embodiment 1, the present invention also provides a kind of Video Encoding Mode of irregular division and selects dress
Put, described device includes, preset unit, gradient information acquiring unit, the first judging unit, the second judging unit, optimum mould
Formula determining unit;
Preset unit, for preset first to the tenth piece of division coding mode;
Gradient information acquiring unit, for the edge using image in arithmetic operators extraction current macro, and according to
The edge of described image obtains the gradient information of view data in current macro;
First judging unit, for arranging described image data binaryzation result according to the gradient information;
Second judging unit, for the view data binaryzation result according to the current macro and selection current macro block
Divide coding mode;
Optimization model determining unit, is divided with the rectangular block of routine for described current macro block is divided coding mode
Pattern is exported in encoder modes selecting module, and the optimum block for selecting current macro divides coding mode.
Preset first to the tenth piece of described preset unit divides coding mode and had specifically described in embodiment 1,
Here is not repeated.
Wherein, the first described judging unit, for arranging described image data binaryzation knot according to the gradient information
Fruit is specially:
Judge whether described gradient information is more than or equal to first threshold, if then arrange the view data binaryzation tying
Fruit is 1, if otherwise arranging the view data binaryzation result for 0.
Wherein, the second described judging unit, for the view data binaryzation result according to the current macro and choosing
Select current macro block division coding mode to be specially:
Judge the view data binaryzation result of current macro and whether be 0, if then current macro is in conventional rectangle
Select a kind of as current macro block division coding mode in block partition mode;If otherwise dividing at preset first to the tenth piece
Select in coding mode it is a kind of current macro is divided, obtain current macro block divide coding mode.
Wherein, the second described judging unit is used to " divide at preset first to the tenth piece in coding mode and select one
Plant and current macro divided, obtain current macro block and divide coding mode " it is specially:
Whether the division methods for judging current macro upper left corner macro block are the three, the six, ten pieces of described division coding modes
In one kind, if then by current macro respectively according to described second, seven, ten block divide coding mode divide;
The block for finding second, seven, ten respectively divides the pixel that coding mode oblique line is passed through, and obtains the figure of the pixel
As gradient information binaryzation result t [i, j] of data;Judge whether described gradient information G [i, j] is more than or equal to the first threshold
Value T, if it is 1 then to arrange view data binaryzation result t [i, j], if otherwise arranging view data binaryzation result t
[i, j] is 0;
Select described second, seven, ten block divide coding mode bend pass through view data binaryzation result t [i,
J] and the maximum blocks of Smode divide coding mode and divide coding mode as current macro block;
Or judge that whether the division methods of macro block directly over current macro are that described the seven, the eight, nine, ten pieces divide coding
One kind in pattern, if current macro is divided coding mode according to described the five, the six, nine, ten block respectively then dividing;
The block for finding the five, the six, nine, ten respectively divides the pixel that coding mode oblique line is passed through, and obtains the pixel
View data gradient information binaryzation result t [i, j];Judge whether described gradient information binaryzation result t [i, j] is big
In or be equal to first threshold, if it is 1 then to arrange view data binaryzation result t [i, j], if otherwise arranging the view data
Binaryzation result t [i, j] is 0;
Described five, the six, nine, ten block is selected to divide view data binaryzation result t that coding mode bend is passed through
[i, j] and Smode maximum block divides coding mode and divides coding mode as current macro block;
Or judge that whether the division methods of current macro left side macro block are that described second, four, nine, ten pieces divide coding moulds
One kind in formula, if current macro is divided coding mode according to described first and third, nine, ten block respectively then dividing;
The block for finding first and third, nine, ten respectively divides the pixel that coding mode oblique line is passed through, and obtains the pixel
View data gradient information;Judge whether described gradient information is more than or equal to first threshold T, if then arranging the figure
As data binaryzation result t [i, j] are 1, if it is 0 otherwise to arrange view data binaryzation result t [i, j];
Described first and third, nine, ten block is selected to divide view data binaryzation result t that coding mode bend is passed through
[i, j] and Smode maximum block divides coding mode and divides coding mode as current macro block;
Or judge that whether the division methods of current macro upper right corner macro block are that described fourth, fifth, nine pieces divide coding moulds
One kind in formula, if current macro is divided coding mode according to described first, eight, nine block respectively then dividing;
The block for finding first, eight, nine respectively divides the pixel that coding mode oblique line is passed through, and obtains the figure of the pixel
As the gradient information G [i, j] of data;Judge whether described gradient information G [i, j] is more than or equal to first threshold, if then
It is 1 to arrange view data binaryzation result t [i, j], if it is 0 otherwise to arrange view data binaryzation result t [i, j];
Select described first, eight, nine block divide coding mode bend pass through view data binaryzation result t [i,
J] and the maximum blocks of Smode divide coding mode and divide coding mode as current macro block;
Or current macro is divided into coding mode division according to described the first to ten block respectively;
The block for finding the first to ten respectively divides the pixel that coding mode oblique line is passed through, and obtains the image of the pixel
The gradient information G [i, j] of data;Judge whether described gradient information G [i, j] is more than or equal to first threshold T, if then setting
It is 1 to put view data binaryzation result t [i, j], if it is 0 otherwise to arrange view data binaryzation result t [i, j];
Described the first to ten block is selected to divide view data binaryzation result t [i, j] that coding mode bend is passed through
Coding mode is divided with Smode maximum block coding mode is divided as current macro block.
Wherein, the gradient information acquiring unit is used to obtaining the gradient information and second of view data in current macro and sentences
Acquisition methods in disconnected unit for obtaining the gradient information of the view data of the pixel are specially:
G [i, i]=| f [i-1, j+1]+2f [i, j+1]+f [i+1, j+1]-f [i-1, j-1] -2f [i, j-1]-f [i+1,
j-1]|+|f[i-1,j-1]+2f[i-1,j]+f[i-1,j+1]-f[i+1,j-1]-2f[i+1,j]-f[i+1,j+1]|;
F [i, j] represents that the i-th row jth row pixel value in macro block, f [i+1, j+1] etc. are to represent pixel f [i, j] in original graph
Adjacent pixel values as in, G [i, j] represent the view data gradient information for calculating
The embodiment of the present invention divides coding mode by preset different block, and macro block is divided and image border characteristic
Around adjacent macroblocks characteristic combines, and current macro is divided coding mode according to different blocks respectively according to different situations
To be divided;Therefore object edge in encoded images can effectively be improved by the method and apparatus of present invention offer
Overcompression phenomenon, the image object edge after coding are more smoothed, and effectively improve the subjective effect of coding.
It will be understood by those skilled in the art that all or part of step in realizing above-described embodiment method is can
Complete with by programmed instruction related hardware, described program can be stored in a computer read/write memory medium,
Described storage medium can be ROM, RAM, disk, CD etc..
Presently preferred embodiments of the present invention is the foregoing is only, not to limit the present invention, all essences in the present invention
Any modification, equivalent and improvement made within god and principle etc., should be included within the scope of the present invention.