Summary of the invention
In view of this, the invention provides region description method and device in a kind of method for video coding, video encoding/decoding method, video coding system, video decoding system and the coding and decoding video, can describe polygonal region and save the transmission bandwidth of code stream.
A kind of method for video coding provided by the invention comprises:
Set up the descriptor of polygonal region, described descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit;
According to the macro block that is covered by described polygonal region in the described descriptor identification video image;
When coding, the macro block that is covered by described polygonal region in the video image is carried out first handle, other macro blocks in the video image are carried out second handle.
A kind of video encoding/decoding method provided by the invention comprises:
Obtain the descriptor of the polygonal region of setting up in advance at the video coding end, described descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit;
According to the macro block that is covered by described polygonal region in the described descriptor identification video image;
In when decoding, the macro block that is covered by described polygonal region in the video image is carried out the 3rd processing, other macro blocks in the video image are carried out the reason everywhere.
In above-mentioned coding method or coding/decoding method:
The coordinate on described summit is: according to the macro block position of raster scan order arrangement.
Described identification is comprised by the macro block that described polygonal region covers:
A1, calculate the macro block of edge line segment process between the macro block on per two expression summits in the polygonal region respectively;
The macro block of the edge line segment process that a2, the macro block that will represent the summit and step a1 calculate is labeled as the edge macro block;
A3, in video image, scan according to raster scan order, the edge macro block that scanning is obtained and in being scanned up to polygonal region the time all macro blocks between two edge macro blocks be defined as the macro block that covered by polygon.
The coordinate on described summit is: the coordinate of place, summit pixel.
Described identification is comprised by the macro block that described polygonal region covers:
B1, calculate the pixel of edge line segment process between the pixel on per two expression summits in the polygonal region respectively;
The pixel of the edge line segment process that b2, the pixel that will represent the summit and step a1 calculate is labeled as edge pixel;
B3, in video image, scan according to raster scan order, the edge pixel that scanning is obtained and in being scanned up to polygonal region the time all pixels between two edge pixels be defined as the pixel that covered by polygon;
B4, the pixel quantity that will be covered by described polygonal region are greater than all macro blocks of predetermined threshold value or exist at least one pixel by all macro blocks that described polygonal region covers, and are defined as the macro block that is covered by described polygonal region.
A kind of video coding system provided by the invention comprises:
The region description unit is used to set up the descriptor of polygonal region, and described descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit;
The macroblock map unit is used for the macro block that is covered by described polygonal region according to described descriptor identification video image;
Coding processing unit is used for the macro block that is covered by described polygonal region in the video image being carried out first handling when coding, other macro blocks in the video image is carried out second handle.
A kind of video decoding system provided by the invention comprises:
The region description unit is used to obtain the descriptor of the polygonal region of setting up in advance at the video coding end, and described descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit;
The macroblock map unit is used for the macro block that is covered by described polygonal region according to described descriptor identification video image;
Codec processing unit is used in when decoding the macro block that is covered by described polygonal region in the video image being carried out the 3rd processing, and other macro blocks in the video image are carried out the reason everywhere.
In above-mentioned coded system or decode system:
The coordinate on described summit is: according to the macro block position of raster scan order arrangement.
Described macroblock map unit comprises:
The edge macro block is determined subelement, is used for calculating respectively the macro block of the edge line segment process between the macro block on per two the expression summits of polygonal region;
Edge macro block mark subelement, be used for will the expression summit macro block and the macro block of the edge line segment process that calculates be labeled as the edge macro block;
Cover macro block scanning subelement, be used for scanning at video image according to raster scan order, the edge macro block that scanning is obtained and in being scanned up to polygonal region the time all macro blocks between two edge macro blocks be defined as the macro block that covered by polygon.
The coordinate on described summit is: the coordinate of place, summit pixel.
Described macroblock map unit comprises:
Edge pixel is determined subelement, is used for calculating respectively the pixel of the edge line segment process between the pixel on per two the expression summits of polygonal region;
Edge pixel mark subelement, be used for will the expression summit pixel and the pixel of the edge line segment process that calculates be labeled as edge pixel;
Cover the picture element scan subelement, be used for scanning at video image according to raster scan order, the edge pixel that scanning is obtained and in being scanned up to polygonal region the time all pixels between two edge pixels be defined as the pixel that covered by polygon;
Cover the macro block judgment sub-unit, be used for the pixel quantity that to be covered by polygonal region greater than all macro blocks of predetermined threshold value or exist at least one pixel, be defined as the macro block that is covered by polygonal region by the macro block that described polygonal region covers.
A kind of region description method provided by the invention comprises:
Receive the polygon vertex coordinate of input;
Set up the descriptor of described polygonal region, described descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit; Wherein, according to described descriptor, the macro block that can before carrying out encoding and decoding, be covered by described polygonal region in the identification video image.
The coordinate on described summit is according to the macro block position of raster scan order arrangement or the coordinate of place, summit pixel.
A kind of region description device provided by the invention comprises:
Information input unit is used to receive the polygon vertex coordinate of input;
Information is set up the unit, is used to set up the descriptor of described polygonal region, and described descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit; Wherein, according to described descriptor, the macro block that can before carrying out encoding and decoding, be covered by described polygonal region in the identification video image.
The coordinate on described summit is according to the macro block position of raster scan order arrangement or the coordinate of place, summit pixel.
As seen from the above technical solution, in the present invention, the descriptor of each polygonal region in the video image only comprise polygonal summit quantity and polygonal apex coordinate rather than should the zone in each macro block under zone number, thereby, can save the transmission bandwidth of code stream than existing exhaustive description.Especially big for size, comprise the more video image of number of macroblocks, the effect that can save the code stream transmission bandwidth is more remarkable.
Embodiment
For making purpose of the present invention, technical scheme and advantage clearer, below with reference to the accompanying drawing embodiment that develops simultaneously, the present invention is described in more detail.
Fig. 1 is the exemplary process diagram of method for video coding in the embodiment of the invention.As shown in Figure 1, the method for video coding in the present embodiment is carried out by the video coding end, specifically comprises:
Step 100, the apex coordinate of polygonal region in receiver, video image and this video image.
In this step, the apex coordinate of the polygonal region of reception can be to import according to the mode according to mouse action in the prior art.
Step 101 is set up the descriptor of polygonal region, and this descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit.Described herein summit is meant the point that intersect on any both sides in the polygon.
In this step, the coordinate on summit can adopt the coordinate of macro-block level, be the coordinate of the macro block position at place, summit for this summit, macro block position as herein described can be expressed as macro block place row and column and be according to the raster scan order setting, suppose to have in the video image 4 * 4 macro blocks, then the macro-block level coordinate of the 1st macro block of the 2nd row is that the macro-block level coordinate of (2,1), the 3rd macro block of the 3rd row is (3,3); The coordinate on summit can also be the coordinate of Pixel-level, the i.e. coordinate of the pixel of position, summit in video image.
Step 102 is according to the descriptor that step 101 is set up, the macro block that is covered by polygonal region in the identification video image.
This step is actual to be to have replaced the mapping process from the macro block to the zone in the prior art.
In this step, be the situation of the macro block position of arranging according to raster scan order for apex coordinate, concrete processing procedure can for:
A1, utilize the scan conversion method of existing any straightway, calculate the macro block of the edge line segment process between the macro block on per two expression summits in the polygonal region respectively;
A2, utilize existing any edge labelling method, the macro block that will the expression summit and the macro block of the edge line segment process that step a1 calculates are labeled as the edge macro block;
A3, utilize existing any polygonal scan conversion method, scan in video image according to raster scan order, the edge macro block that scanning is obtained and in being scanned up to polygonal region the time all macro blocks between two edge macro blocks be defined as the macro block that covered by polygon.
Wherein, in step a3, can set in advance the variable whether an expression is positioned at polygonal region, the value of this variable can be positioned at " very " of polygonal region and expression in expression and be positioned between " vacation " polygonal region outside and overturn, and before the scanning beginning, the initial value of this variable begins the scanning back for expression is positioned at polygonal region outer " vacation ":
All be positioned at its below or all be positioned at its top if scan the macro block on expression summit and the other end of two edge line segments under this macro block, will represent that then the macro block on summit is defined as the macro block that is covered by polygon and keeps the value of variable constant;
Lay respectively at its below and top if scan the other end of two edge line segments under the expression macro block on summit and this macro block, the value that the macro block that then will represent the summit is defined as the macro block that is covered by polygon and variable is set is overturn;
If scan the edge line segment the macro block of process, then this macro block is defined as the macro block that is covered by polygon and the value upset of variable is set;
If scan except that expression macro block on summit and edge line segment other macro blocks the macro block of process, and the current value of variable be " very ", the value that then this macro block is defined as the macro block that covered by polygon and maintenance variable is constant.
In this step, be the situation of the coordinate of place, summit pixel for the coordinate on summit, concrete processing procedure can comprise:
B1, utilize the scan conversion method of existing any straightway, calculate the pixel of the edge line segment process between the pixel on per two expression summits in the polygonal region respectively;
B2, utilize existing any edge labelling method, the pixel that will the expression summit and the pixel of the edge line segment process that step a1 calculates are labeled as edge pixel;
B3, utilize existing any polygonal scan conversion method, scan in video image according to raster scan order, the edge pixel that scanning is obtained and in being scanned up to polygonal region the time all pixels between two edge pixels be defined as the pixel that covered by polygon;
B4, the pixel quantity that will be covered by described polygonal region are greater than all macro blocks of predetermined threshold value or exist at least one pixel by all macro blocks that described polygonal region covers, and are defined as the macro block that is covered by described polygonal region.
Wherein, the concrete principle of step b3 and above-mentioned steps a3 are basic identical.Specifically, in step b3, also can set in advance the variable whether an expression is positioned at polygonal region, the value of this variable can be positioned at " very " of polygonal region and expression in expression and be positioned between " vacation " polygonal region outside and overturn, and before the scanning beginning, the initial value of this variable begins the scanning back for expression is positioned at polygonal region outer " vacation ":
All be positioned at its below or all be positioned at its top if scan the pixel on expression summit and the other end of two edge line segments under this pixel, will represent that then the pixel on summit is defined as the pixel that is covered by polygon and keeps the value of variable constant;
Lay respectively at its below and top if scan the other end of two edge line segments under the expression pixel on summit and this pixel, the value that the pixel that then will represent the summit is defined as the pixel that is covered by polygon and variable is set is overturn;
If scan the edge line segment the pixel of process, then this pixel is defined as the pixel that is covered by polygon and the value upset of variable is set;
If scan except that expression pixel on summit and edge line segment other pixels the pixel of process, and the current value of variable be " very ", the value that then this pixel is defined as the pixel that covered by polygon and maintenance variable is constant.
Step 103, in when coding, the macro block that the polygonal region that is expressed important area in the video image is covered carries out first to be handled, and other macro blocks of normal areas in the video image is carried out second handle.
In this step; second processing is meant normal video coding processing; and first processing; then can comprise second and handle and for example error protection or recovery wait other processing that can improve picture quality, also can other can improve the encoding process of picture quality in order to be different from the second for example variable mass coding of handling, variable resolution coding, variable code rate coding etc.Certainly, different as long as first processing and second is handled, then the two can be respectively any processing.
So far, this flow process finishes.
In the above-mentioned flow process, step 101 and step 102 have promptly constituted the region description method in the present embodiment.
In addition, the video decode end belongs to each macro block of important area and carries out contrary the processing in order to identify according to the descriptor that above-mentioned steps 101 is set up in the video image after the encoding process, after above-mentioned flow process, the descriptor of can also be further step 101 being set up is carried on the predeterminated position in the code stream that video image constituted behind the coding, and is sent to the video decode end, decodes for the video decode end.Wherein, predeterminated position described here can be the position that the header etc. of for example video image is consulted in advance arbitrarily and known by the coding and decoding video end.
Fig. 2 is the exemplary process diagram of video encoding/decoding method in the embodiment of the invention, and as shown in Figure 2, the video encoding/decoding method in the present embodiment is carried out by the video decode end, specifically comprises:
Step 201 is obtained the descriptor of the polygonal region of setting up in advance at the video coding end, and descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit.
The coordinate on the summit in this step can be the coordinate of macro-block level, also can be the coordinate of Pixel-level, and identical with in as shown in Figure 1 the method for video coding do not repeat them here.
Step 202, the macro block that is covered by polygonal region in the descriptor identification video image that obtains according to step 201.
Concrete processing procedure in this step is identical with the basic principle of step 102 in the method for video coding, does not repeat them here.
Step 203, in when decoding, the macro block that the polygonal region that is expressed important area in the video image is covered carries out the 3rd processing, and other macro blocks in the video image are carried out the reason everywhere.
In this step, the 3rd is treated to contrary processing that first described in the method for video coding handled, the everywhere reason then be the contrary processing that second described in the method for video coding handled.
It more than is explanation to method for video coding, video encoding/decoding method and region description method in the present embodiment.Below, again video coding system, video decoding system and region description device in the present embodiment are elaborated.
Fig. 3 is the exemplary block diagram of video coding system in the embodiment of the invention.As shown in Figure 3, the video coding system in the present embodiment comprises:
Region description unit 301 is used for the apex coordinate of receiver, video image and this video image polygonal region; Set up the descriptor of polygonal region, described descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit;
Macroblock map unit 302 is used for the macro block that is covered by described polygonal region according to described descriptor identification video image;
Coding processing unit 303 is used for the macro block that is covered by described polygonal region in the video image being carried out first handling when coding, other macro blocks in the video image is carried out second handle.
In said system, region description unit 301 can promptly constitute the region description device in the present embodiment, and this device can specifically comprise (not shown among Fig. 3) independently as a device:
Information is imported subelement, is used for receiving video image and this video image polygon vertex coordinate of input;
Information is set up subelement, is used to set up the descriptor of described polygonal region, and described descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit; Wherein, according to described descriptor, the macro block that can before carrying out encoding and decoding, be covered by described polygonal region in the identification video image.
In the practical application, the coordinate on the related summit of video coding system can be the coordinate of macro-block level in the present embodiment, can be the coordinate of Pixel-level, apex coordinate described herein identical with described in the method for video coding as shown in Figure 1 do not repeat them here yet.
For the apex coordinate of macro-block level, macroblock map unit 302 can specifically comprise (not shown among Fig. 3):
The edge macro block is determined subelement, is used for calculating respectively the macro block of the edge line segment process between the macro block on per two the expression summits of polygonal region;
Edge macro block mark subelement, be used for will the expression summit macro block and the macro block of the edge line segment process that calculates be labeled as the edge macro block;
Cover macro block scanning subelement, be used for scanning at video image according to raster scan order, the edge macro block that scanning is obtained and in being scanned up to polygonal region the time all macro blocks between two edge macro blocks be defined as the macro block that covered by polygon.
For the apex coordinate of Pixel-level, macroblock map unit 302 can specifically comprise (not shown among Fig. 3):
Edge pixel is determined subelement, is used for calculating respectively the pixel of the edge line segment process between the pixel on per two the expression summits of polygonal region;
Edge pixel mark subelement, be used for will the expression summit pixel and the pixel of the edge line segment process that calculates be labeled as edge pixel;
Cover the picture element scan subelement, be used for scanning at video image according to raster scan order, the edge pixel that scanning is obtained and in being scanned up to polygonal region the time all pixels between two edge pixels be defined as the pixel that covered by polygon;
Cover the macro block judgment sub-unit, be used for the pixel quantity that to be covered by polygonal region greater than all macro blocks of predetermined threshold value or exist at least one pixel, be defined as the macro block that is covered by polygonal region by the macro block that described polygonal region covers.
In addition, in the present embodiment, the video decode end belongs to each macro block of important area and carries out contrary the processing in order to identify according to the descriptor that region description unit 301 is set up in the video image after the encoding process, the descriptor that coding processing unit 303 can also be further set up region description unit 301 is carried on the predeterminated position in the code stream that video image constituted behind the coding, and is sent to the video decode end, decodes for the video decode end.Wherein, predeterminated position described here can be the position that the header etc. of for example video image is consulted in advance arbitrarily and known by the coding and decoding video end.
Fig. 4 is the exemplary block diagram of video decoding system in the embodiment of the invention.As shown in Figure 4, the video decoding system in the present embodiment comprises:
Information acquisition unit 401 is used to obtain the descriptor of the polygonal region of setting up in advance at the video coding end, and described descriptor comprises the number of vertices of this polygonal region and the coordinate on each summit;
Macroblock map unit 402 is used for the macro block that is covered by described polygonal region according to described descriptor identification video image;
Codec processing unit 403 is used in when decoding the macro block that is covered by described polygonal region in the video image being carried out the 3rd processing, and other macro blocks in the video image are carried out the reason everywhere.
Wherein, the first contrary processing of handling that the 3rd is treated in the video coding system is carried out, then the second contrary processing of handling of reason everywhere for being carried out in the video coding system.
In the practical application, the coordinate on the related summit of video decoding system can be the coordinate of macro-block level in the present embodiment, can be the coordinate of Pixel-level, apex coordinate described herein identical with described in the method for video coding as shown in Figure 1 do not repeat them here yet.
And for the apex coordinate of macro-block level and the apex coordinate of Pixel-level, macroblock map unit 402 can have identical structure with the macroblock map unit 302 in as shown in Figure 3 the video coding system, does not repeat them here.
As seen from the above-described embodiment, the descriptor of each polygonal region in the video image only comprise polygonal summit quantity and polygonal apex coordinate rather than should the zone in each macro block under zone number, thereby, can save the transmission bandwidth of code stream than existing exhaustive description.Especially big for size, comprise the more video image of number of macroblocks, the effect that can save the code stream transmission bandwidth is more remarkable.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to and replace and improvement etc., all should be included within protection scope of the present invention.