Summary of the invention
The object of the present invention is to provide a kind of intra prediction mode decision method, it is related that the angle needed to be traversed for can be reduced
The number of intra prediction mode improve the efficiency of intra prediction to reduce the calculation amount in pre-analysis process;Of the invention
Another object is to provide a kind of device based on the above method, equipment and computer readable storage medium.
In order to solve the above technical problems, the present invention provides a kind of intra prediction mode decision methods, comprising:
The validity for analyzing the adjacent macroblocks of current macroblock to be encoded determines effective intra prediction of the macroblock to be encoded
Mode;
Judge whether the quantity of effective intra prediction mode exceeds preset threshold, if exceeding, calculates described to be encoded
The deflection of image texture in macro block;The preset threshold is the positive integer greater than 2;
According to preset matching rule, from the relevant effective intra prediction mode of all angles of the macroblock to be encoded,
Determine the immediate intra prediction mode of deflection of angle Yu described image texture;
Respectively under the intra prediction mode and DC prediction mode of aforementioned determination, carry out pre- in the frame of the macroblock to be encoded
It surveys, the prediction mode for the selecting intra-prediction result best intra prediction mode final as the macroblock to be encoded.
Preferably, if the quantity of effective intra prediction mode is without departing from preset threshold, respectively described to be encoded
Macro block effectively under each intra prediction mode, carries out the intra prediction of the macroblock to be encoded, selects intra-prediction result most
The good prediction mode intra prediction mode final as the macroblock to be encoded.
Preferably, described according to preset matching rule, out of, the macroblock to be encoded the relevant valid frame of all angles
In prediction mode, the process of the immediate intra prediction mode of deflection of angle and described image texture is determined, comprising:
It calculates separately in the deflection valid frame relevant to all angles of the macroblock to be encoded of described image texture
Difference between the angle of prediction mode, using difference the smallest one effective intra prediction mode as the side of described image texture
To the matched intra prediction mode in angle.
It is described regular according to preset matching, from the relevant effective intra prediction mode of all angles of the macroblock to be encoded
In, determine the process of the immediate intra prediction mode of deflection of angle and described image texture, comprising:
By the corresponding predetermined angle of the deflection of described image texture effective intra prediction mode relevant to all angles
Range intervals are compared, by the corresponding effective intra prediction mould in angular range section belonging to the deflection of described image texture
Formula, the matched intra prediction mode of deflection as described image texture.
Preferably, further includes:
If the deflection of described image texture exceeds the relevant effective intra prediction of all angles of the macroblock to be encoded
The angular range of mode, then it is described according to preset matching rule, from the relevant valid frame of all angles of the macroblock to be encoded
In inner estimation mode, the process of the immediate intra prediction mode of deflection of angle and described image texture is determined, comprising:
Preferably, the macroblock to be encoded is applied in AVS or AVS+ cataloged procedure, and the preset threshold is 5.
Preferably, the process that the deflection of image texture in the macroblock to be encoded is calculated according to the gradient value
Are as follows:
Calculate the gradient value of whole luminance points in the macroblock to be encoded;
The deflection of whole luminance points in the macroblock to be encoded is calculated according to the gradient value and deflection relational expression;
The deflection relational expression are as follows:
θ=arctan (yGradient/xGradient),Wherein, θ is deflection, and xGradient is
Gradient value in horizontal direction, yGradient are the gradient value in vertical direction;
Calculate the mean value of the deflection of whole luminance points in the macroblock to be encoded, the as direction of described image texture
Angle.
In order to solve the above technical problems, the present invention also provides a kind of intra prediction mode judgment devices, comprising:
Mode quantity analysis module, the validity of the adjacent macroblocks for analyzing current macroblock to be encoded, determine it is described to
Effective intra prediction mode of coded macroblocks;
Threshold value judgment module, for judging whether the quantity of effective intra prediction mode exceeds preset threshold, if super
Out, then trigger angle computing module;The preset threshold is the positive integer greater than 2;
The angle calculation module, for calculating the deflection of image texture in the macroblock to be encoded;
Matching module, for regular according to preset matching, from the relevant valid frame of all angles of the macroblock to be encoded
In inner estimation mode, the immediate intra prediction mode of deflection of angle Yu described image texture is determined;
Quick predict module, for respectively under the intra prediction mode and DC prediction mode of aforementioned determination, described in progress
The intra prediction of macroblock to be encoded, the prediction mode for the selecting intra-prediction result best frame final as the macroblock to be encoded
Inner estimation mode.
In order to solve the above technical problems, the present invention also provides a kind of intra prediction mode decision devices, comprising:
Memory, for storing computer program;
Processor realizes the intra prediction mode judgement as described in any of the above item when for executing the computer program
The step of method.
In order to solve the above technical problems, the computer can the present invention also provides a kind of computer readable storage medium
It reads to be stored with computer program on storage medium, be realized as described in any of the above item when the computer program is executed by processor
Intra prediction mode decision method the step of.
The present invention provides a kind of intra prediction mode decision methods, it is first determined pre- in current macroblock to be encoded valid frame
Survey mode, if the quantity of the currently active intra prediction mode is beyond preset threshold, (preset threshold is greater than 2, i.e., in the currently active frame
The quantity of prediction mode includes at least a DC mode and the relevant mode of 2 angles), that is, show the currently active intra prediction
The quantity of mode is larger, if calculation amount is larger if all traversal carries out preanalysis, therefore the present invention is to be encoded macro by calculating
The deflection of block image texture, later in the relevant effective intra prediction mode of all angles of macroblock to be encoded, selected angle
With the immediate intra prediction mode of deflection of image texture;It traverses later pre- in the aforementioned relevant frame of angle for selecting to obtain
Survey mode and DC prediction mode carry out preanalysis, by result it is optimal as final intra prediction mode.As it can be seen that in angle
When relevant effective intra prediction mode is no less than 2, in order to reduce workload when preanalysis, the present invention passes through deflection figure
As the matched mode of the deflection of texture, effective intra prediction mode relevant to angle has carried out preliminary screening, so that subsequent
In pre-analysis process, the relevant intra prediction mode of the angle needed to be traversed for is only 1, and it is related to reduce the angle needed to be traversed for
Intra prediction mode number, thus greatly reduce the calculation amount in pre-analysis process, thereby reduce intra prediction mould
Calculation amount in formula selection course improves the efficiency of intra prediction.The present invention also provides a kind of dresses based on the above method
It sets, equipment and computer readable storage medium.
Specific embodiment
Core of the invention is to provide a kind of intra prediction mode decision method, and it is related can to reduce the angle needed to be traversed for
The number of intra prediction mode improve the efficiency of intra prediction to reduce the calculation amount in pre-analysis process;Of the invention
Another core is to provide a kind of device based on the above method, equipment and computer readable storage medium.
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
The description and claims of this application and term " first ", " second ", " third ", " in above-mentioned attached drawing
The (if present)s such as four " are to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should manage
The data that solution uses in this way are interchangeable under appropriate circumstances, so that the embodiments described herein can be in addition to illustrating herein
Or the sequence other than the content of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that
Cover it is non-exclusive include, for example, containing the process, method, system, product or equipment of a series of steps or units need not limit
In step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, produce
The other step or units of product or equipment inherently.
It should be noted that the description for being related to " first ", " second " etc. in the present invention is used for description purposes only, and cannot
It is interpreted as its relative importance of indication or suggestion or implicitly indicates the quantity of indicated technical characteristic.Define as a result, " the
One ", the feature of " second " can explicitly or implicitly include at least one of the features.In addition, the skill between each embodiment
Art scheme can be combined with each other, but must be based on can be realized by those of ordinary skill in the art, when technical solution
Will be understood that the combination of this technical solution is not present in conjunction with there is conflicting or cannot achieve when, also not the present invention claims
Protection scope within.
Shown in Figure 1 the present invention provides a kind of intra prediction mode decision method, Fig. 1 is provided by the invention one
The flow chart of the process of kind intra prediction mode decision method;This method comprises:
Step s1: the validity of the adjacent macroblocks of current macroblock to be encoded is analyzed, is determined in the valid frame of macroblock to be encoded
Prediction mode;
It is understood that due between pixel continuous in a frame image image there are front and back correlation, can
By using image prediction is carried out in a manner of predictive coding, at this time what is exported after predictive coding be no longer original pixel value,
But the difference of the predicted value of pixel and actual value.The starting point that predictive coding is designed in this way is, since front and back has correlation
Property, there are a large amount of same or similar phenomenons in neighbor pixel, by calculating its difference, it is possible to reduce is largely used to save and pass
The data volume of the value of defeated original image vegetarian refreshments.And predictive coding includes inter-prediction and intra prediction, intra prediction refers to together
It is compared between pixel in one frame image, obtains the coding of final output according to its difference.In addition, intra prediction includes brightness
With coloration two parts, although the size of brightness and coloration is had any different, the principle of its intra prediction is consistent.The present invention is directed to
Be brightness intra prediction.
Since intra prediction is uncoded pixel after being predicted using coded pixel, prediction mode includes DC
Prediction mode and the relevant prediction mode of angle, wherein the relevant prediction mode of angle refers to: each pixel it is pre-
Measured value is predicted to obtain by the value of pixel adjacent on corresponding angle direction under the mode.DC prediction mode refer to top and
The deflection of the image texture of left adjacent pixel indicates the predicted value of entire pixel to be predicted.Wherein, on piece image due to
The difference of location of pixels, around coded pixel it is different relative to the orientation angle of current pixel to be predicted, it is therefore, right
For partial macroblock, the relevant prediction mode of some angles is not available, therefore, the present invention need first to prediction mode into
Row analysis determines which kind the corresponding effective intra prediction mode of current macroblock to be encoded is respectively.
Step s2: judging whether the quantity of effective intra prediction mode exceeds preset threshold, if exceeding, enters step
s3;Preset threshold is the positive integer greater than 2;
The purpose of the present invention is needed time to solve at present when determining final intra prediction mode in the preanalysis stage
Going through whole intra prediction modes leads to computationally intensive problem, and the mode that the present invention takes is the relevant valid frame of screening angle
Inner estimation mode after being reduced to a kind, then carries out subsequent traversal.It therefore, is only 2 for effective number of intra prediction mode,
In the case that i.e. effective intra prediction mode only includes DC prediction mode and a kind of relevant prediction mode of angle, still carry out subsequent
The process for screening the relevant effective intra prediction mode of angle is then nonsensical, cannot achieve the purpose for reducing calculation amount.Therefore,
The present invention is only greater than preset threshold in the quantity of effective intra prediction mode, and preset threshold is greater than 2, the i.e. relevant valid frame of angle
In the case where inner estimation mode more than one, just effective intra prediction mode relevant to angle is screened, and reduces its quantity,
And in the case where the relevant effective intra prediction mode of angle only has a kind or do not have, then by the way of directly traversing, from
And ensure that as far as possible for any macro block, the calculation amount of intra prediction mode judging process is all made of the smallest side of calculation amount
Formula.
Step s3: the deflection of image texture in macroblock to be encoded is calculated;
Here the deflection of the image texture of the deflection of whole luminance points is macroblock to be encoded in image texture direction
Average angle in trend.
It is understood that the relevant intra prediction mode of angle is when carrying out intra prediction, i.e., it can be according to pre- in the frame
Encoded pixel on the angle direction of survey mode predicts current pixel.Therefore, a most suitable angle of macroblock to be encoded
The angle of relevant intra prediction mode is relevant, or perhaps matched to the image texture direction of the macroblock to be encoded.
Therefore, the present invention by calculate macroblock to be encoded in luminance point gradient value, come obtain macroblock to be encoded image texture angle
Spend information (i.e. the deflection of the image texture of deflection), later angle with in the immediate frame of deflection of the image texture
Prediction mode, as predictive coding direction closest to macroblock to be encoded image texture intra prediction mode, being also should be to
The relevant intra prediction mode of the most suitable angle of coded macroblocks.
Step s4: according to preset matching rule, from the relevant effective intra prediction mode of all angles of macroblock to be encoded
In, determine the immediate intra prediction mode of the deflection of angle and image texture;
Step s5: respectively under the intra prediction mode and DC prediction mode of aforementioned determination, the frame of macroblock to be encoded is carried out
Interior prediction, the prediction mode for the selecting intra-prediction result best intra prediction mode final as macroblock to be encoded.
It is understood that DC prediction mode refers to the deflection table of the image texture with top and left adjacent pixel
Show the predicted value of entire pixel to be predicted.It is the direction from top to bottom along from left to right when carrying out intra prediction due to macro block
It carries out, therefore, under normal circumstances, effective intra prediction mode of macro block includes DC prediction mode certainly.Therefore, from multiple
After screening obtains the relevant intra prediction mode of a most suitable angle in the relevant intra prediction mode of angle, respectively at this
The preanalysis that intra prediction is carried out under the relevant intra prediction mode of angle and DC prediction mode, by result preferably (i.e. distortion rate
It is minimum), as final intra prediction mode.
After selecting final intra prediction mode, can with direct basis the final intra prediction mode to be encoded
Macro block carries out intraframe predictive coding;Or can continue to repeat the above process next macroblock to be encoded, until to be encoded
After whole macro blocks determine final intra prediction mode in picture frame, uniformly treats whole macro blocks in encoded image frame and carry out frame
Intraprediction encoding.Which kind of mode is specifically used, the present invention is not construed as limiting.
The present invention provides a kind of intra prediction mode decision methods, it is first determined pre- in current macroblock to be encoded valid frame
Survey mode, if the quantity of the currently active intra prediction mode is beyond preset threshold, (preset threshold is greater than 2, i.e., in the currently active frame
The quantity of prediction mode includes at least a DC mode and the relevant mode of 2 angles), that is, show the currently active intra prediction
The quantity of mode is larger, if calculation amount is larger if all traversal carries out preanalysis, therefore the present invention passes through in macroblock to be encoded
The deflection of the image texture of the deflection of whole luminance points is calculated in macroblock to be encoded in the gradient value of luminance point, later to
In the relevant effective intra prediction mode of all angles of coded macroblocks, the deflection of selected angle and image texture is immediate
Intra prediction mode;The aforementioned relevant intra prediction mode of angle for selecting to obtain is traversed later and DC prediction mode carries out in advance
Analysis, by result it is optimal as final intra prediction mode.As it can be seen that many in the relevant effective intra prediction mode of angle
When 2, in order to reduce workload when preanalysis, the present invention by the matched mode of deflection of deflection image texture,
Effective intra prediction mode relevant to angle has carried out preliminary screening, so that in subsequent pre-analysis process, the angle that needs to be traversed for
Spending relevant intra prediction mode is only 1, reduces the number of the relevant intra prediction mode of the angle needed to be traversed for, thus
The calculation amount in pre-analysis process is greatly reduced, the calculation amount during Intra prediction mode selection is thereby reduced, is improved
The efficiency of intra prediction.
In an advantageous embodiment, shown in Figure 2, Fig. 2 is that another intra prediction mode provided by the invention is sentenced
The certainly flow chart of the process of method;This method further include: if the quantity of effectively intra prediction mode without departing from preset threshold, into
Enter step s6;
Step s6: respectively under macroblock to be encoded effectively each intra prediction mode, in the frame that carries out macroblock to be encoded
Prediction, the prediction mode for the selecting intra-prediction result best intra prediction mode final as macroblock to be encoded.
It is understood that when number of intra prediction mode is less, if still extra computation deflection and progress side
If the matching operation of angle, overall calculation amount can be made larger instead, therefore, in this case, the present invention is using script
The mode of effective each intra prediction mode is traversed to carry out the determination of intra prediction mode.So that in various situations
Under, the determination of intra prediction mode can by calculate it is as small as possible in a manner of carry out, to reduce determining intra prediction
Overall calculation amount when mode.
In an advantageous embodiment, the process of step s4 includes:
The deflection for calculating separately image texture effective intra prediction mode relevant to all angles of macroblock to be encoded
Angle between difference, using difference the smallest one effective intra prediction mode as the matched frame of the deflection of image texture
Inner estimation mode.
In the present embodiment, since the purpose of step s4 is to determine that angle and the deflection of described image texture most connect
Close intra prediction mode, therefore can be directly by the deflection of image texture effective intra prediction mould relevant to all angles
It is poor that formula make, and the smallest difference is immediate intra prediction mode.
In an advantageous embodiment, the process of step s4 includes:
By the corresponding predetermined angle range of the deflection of image texture effective intra prediction mode relevant to all angles
Section is compared, the corresponding effective intra prediction mode in angular range section belonging to the deflection by image texture, as
The matched intra prediction mode of the deflection of image texture.
It is understood that due to the corresponding angle of the relevant each intra prediction mode of angle be it is fixed,
In the present embodiment, the corresponding predetermined angle range intervals of the relevant intra prediction mode of each angle have been divided in advance, this is default
Angular range section refers to the direction angle range of the matched image texture of corresponding intra prediction mode.For example,
Under identical reference axis, it is assumed that corresponding mode 1 is 0 °, then the corresponding predetermined angle range intervals of mode 1 be -22.5 °~
22.5 °, that is, belong to the deflection of image texture within the scope of this, equal match pattern 1.It should be noted that due to when in default
When on the boundary line in angular range section, show the deflection of image texture two intra prediction modes corresponding with the boundary line
Matching degree is identical, in this case, can choose any matched intra prediction mode of the deflection as image texture;
Alternatively, the two can also be all used as to the matched intra prediction mode of the deflection of image texture.Specifically how to select, this hair
It is bright that this is not construed as limiting.The present embodiment this setup, it is only necessary to check angular range belonging to the deflection of image texture
Section does not need to calculate the difference between the deflection angle corresponding with each intra prediction mode of image texture, subtracts
The small calculation amount of the deflection matching process of image texture improves the efficiency of intra prediction mode judgement.
It should be noted that in order to guarantee angle make difference correctness, the deflection for the image texture that the present invention obtains with
The angle value of the relevant effective intra prediction mode of all angles needs to be the absolute angle angle value based on the same reference axis, this
The angle difference being calculated after sample can correctly reflect the deflection of image texture valid frame relevant to all angles
Matching degree between inner estimation mode.
Preferably, it is horizontal direction that reference axis here, which can be axis of abscissas, and axis of ordinates is vertical direction
Reference axis, 0 ° of positive axis for axis of abscissas.In addition, if the macroblock to be encoded in the present invention is encoded applied to AVS or AVS+
In journey, due to AVS or AVS+ coding only include 5 kinds of prediction modes (the relevant prediction mode of DC+4 kind angle), as Fig. 3~
Shown in Fig. 7 and table 1, wherein the top of 8x8 luminance block and left pixel c and r are encoded and reconstructed pixel, are used as encoding and decoding
Prediction reference pixel in device.Unmarked number is pixel to be predicted in space, utilizes r row and the c pixel value arranged and corresponding
Intra prediction mode is realized.The angular range span of this relevant prediction mode of 4 kinds of angles is 180 °, therefore, at this point it is possible to
On the basis of mode 3, the angle of all intra prediction modes is normalized;The angle position of mode 3 is considered as 0 °, complementary angle
Degree is according to increase is rotated counterclockwise, and the results are shown in Table 2 after normalization.Later, (i.e. according to normal reference axis angle
Axis of abscissas is horizontal direction, and axis of ordinates is the reference axis of vertical direction, 0 ° of positive axis for axis of abscissas) figure is calculated
As texture deflection after, then the deflection of image texture is converted into the angle value in the reference axis on the basis of 3 in mode, it
The angle according to angle effective intra prediction mode relevant with all angles after conversion is compared afterwards.Certainly, it is above only
For several specific implementations, the set-up mode of the unlimited position fixing axis of the present invention.
The direction of the intra prediction mode of table 1 AVS, AVS+ describes
Mode |
Description |
Mode 0 (vertical) |
Vertical direction |
Mode 1 (level) |
Horizontal direction |
Mode 2 (DC) |
———— |
Mode 3 (under left diagonal line) |
It is 45 degree to the left vertical |
Mode 4 (lower right diagonal line) |
It is 45 degree to the right vertical |
The angle information of table 2 AVS, AVS+ normalize
Frame mode |
Former angle information |
Angle information after normalization |
3 |
It is 45 degree to the left vertical |
0 degree |
0 |
Vertically |
45 degree |
4 |
It is 45 degree to the right vertical |
90 degree |
1 |
Horizontal direction |
135 degree |
Preferably, in step s4, further includes:
If the angle of all angles relevant effective intra prediction mode of the deflection of image texture beyond macroblock to be encoded
Range is spent, then enters step s6.
It is understood that when macroblock to be encoded is applied in AVS or AVS+ cataloged procedure, since AVS or AVS+ is compiled
The corresponding angular range of the relevant prediction mode of angle that code includes is 180 °, rather than 360 °.In this case, it is assumed that mode
1 is if 0 °, then the corresponding angular range of intra prediction mode is only -125 °~45 ° in AVS or AVS+ coding, and except this it
Outer angle then has exceeded the angular range, in this case, if the deflection of image texture exceeds the angular range, according to
The mode of angle automatching can not determine the matched effective frame mode of the deflection of image texture, therefore, it is necessary to enter step s6,
It is predicted by the way of traversing entirely.This mode can be avoided the deflection of image texture beyond intra prediction mode
When angular range, be its erroneous matching intra prediction mode the case where, thus improve intra prediction mode judgement accuracy.
Preferably, macroblock to be encoded is applied in AVS or AVS+ cataloged procedure, preset threshold 5.
It is understood that only including 5 kinds of intra prediction modes, therefore, the present embodiment in AVS or AVS+ cataloged procedure
When the corresponding effective intra prediction mode of macroblock to be encoded is 5, i.e., when the relevant intra prediction mode of angle is 4 kinds, carry out
Intra prediction mode screening.It should be noted that due to the present invention carry out image texture deflection calculating be also required to it is certain
Calculation amount, therefore, when preset threshold setting is smaller, advantages of the present invention is not obvious, but when preset threshold setting is larger
When, when being such as set as 5, the present invention can will traverse the process of the relevant intra prediction mode of 4 kinds of angles, be reduced to only traverse 1
The relevant intra prediction mode of kind angle, to greatly simplify the process of intra prediction mode judgement.Certainly, the present invention and unlimited
Determine the specific setting numerical value of preset threshold.
Wherein, macroblock to be encoded is the macro block of 8x8.
It is understood that due to macro block divide it is too small if so that number of macroblocks in a frame to be encoded can be very much,
Cause entire frame to be encoded when carrying out intra prediction, calculation amount is larger;And if macro block division is excessive, it may be such that one
The image for including in macro block contains different textures, i.e., the part for needing to be predicted by different intra prediction modes originally,
It is macro block since macro block divides excessive and intra prediction unit, causes the intra prediction mode of selection can not be well
Suitable for the different piece of a macro block, cause to influence intra-prediction result.And the macro block of 8x8 is macro compared to 4x4 or 16x16
For block, size division is more appropriate, not too big or too small, therefore, can avoid the above problem as far as possible.Certainly, may be used
Think the macro block of 4x4 or 16x16, this is not limited by the present invention.
Wherein, the process of the deflection of image texture in the macroblock to be encoded is calculated according to the gradient value are as follows:
Calculate the gradient value of whole luminance points in macroblock to be encoded;
The deflection of whole luminance points in macroblock to be encoded is calculated according to gradient value and deflection relational expression;The direction
Angular dependence formula are as follows:
θ=arctan (yGradient/xGradient),Wherein, θ is deflection, and xGradient is
Gradient value in horizontal direction, yGradient are the gradient value in vertical direction;
Calculate the mean value of the deflection of whole luminance points in the macroblock to be encoded, the as direction of described image texture
Angle.
It is understood that image function f (x, y) is the vector with size and Orientation in the gradient of point (x, y),
It is set as GxAnd Gy, successively indicate the gradient in the direction x and the direction y.The direction of gradient is that function f (x, y) changes most fast direction, when
Image centainly has biggish gradient value there are when edge, on the contrary, when there is smoother part in image, gray-value variation
Smaller, then corresponding gradient is also smaller.The vector of gradient can indicate are as follows:
The amplitude of the vector are as follows:
Deflection are as follows:
Concrete application in the present invention, i.e., for digital picture f (x, y) two-dimensional for one, needs to complete X, Y two
Partial differential is sought on direction, following formula:
For discrete image, the mathematical expression of first differential is equivalent to the difference of two adjacent pixels, according to choosing
The gradient operator selected is different, and effect may be different, but basic principle will not change.The most common operator is Roberts
Operator, other common also Sobel, the operators such as Prewitt.The gradient of X, Y by taking Roberts operator as an example calculate demonstration as schemed
Shown in 12, the gradient of point (x, y), which is equivalent to, seeks gradient to two-dimensional discrete function, and process is as follows:
Gx=f (x, y)-f (x-1, y)
Gy=f (x, y)-f (x, y-1)
And according to aforementioned formula, the deflection relational expression in the present invention can be obtained:
θ=arctan (yGradient/xGradient),
Further, according to the formula, it can be deduced that classify in following angular interval:
When xGradient >=0, yGradient >=0,As shown in Figure 8;
When xGradient>0, yGradient<0,As shown in Figure 9;
When xGradient<0, yGradient>=0,As shown in Figure 10;
When xGradient < 0, yGradient < 0,As shown in figure 11.
The present invention also provides a kind of intra prediction mode judgment devices, and shown in Figure 13, Figure 13 provides for the present invention
A kind of intra prediction mode judgment device structural schematic diagram.The device includes:
Mode quantity analysis module 1, the validity of the adjacent macroblocks for analyzing current macroblock to be encoded, determines to be encoded
Effective intra prediction mode of macro block;
Threshold value judgment module 2, for judging whether the quantity of effective intra prediction mode exceeds preset threshold, if exceeding,
Then trigger angle computing module 3;Preset threshold is the positive integer greater than 2;
Angle calculation module 3, for calculating the deflection of image texture in macroblock to be encoded;
Matching module 4, it is pre- out of macroblock to be encoded the relevant valid frame of all angles for regular according to preset matching
In survey mode, the immediate intra prediction mode of the deflection of angle and image texture is determined;
Quick predict module 5, under the intra prediction mode and DC prediction mode of aforementioned determination, carrying out respectively wait compile
The intra prediction of decoding macroblock, the prediction mode for the selecting intra-prediction result best intra prediction mould final as macroblock to be encoded
Formula.
Preferably, threshold value judgment module 2 is when the quantity for judging effective intra prediction mode is without departing from preset threshold,
Then trigger traversal prediction module 6;
Prediction module 6 is traversed, under macroblock to be encoded effectively each intra prediction mode, carrying out to be encoded respectively
The intra prediction of macro block, the prediction mode for the selecting intra-prediction result best intra prediction mould final as macroblock to be encoded
Formula.
It may or may not be physically separated with upper module, it can it is in one place, or can also
To be distributed on multiple network modules.Some or all of the modules therein can be selected to realize this reality according to the actual needs
Apply the purpose of a scheme.
It is apparent to those skilled in the art that for convenience and simplicity of description, the device of foregoing description
Specific work process, can refer to corresponding processes in the foregoing method embodiment, details are not described herein.
The present invention also provides a kind of intra prediction mode decision devices, comprising:
Memory, for storing computer program;
Processor realizes the step of the intra prediction mode decision method such as any of the above item when for executing computer program
Suddenly.
Wherein, memory includes at least a type of readable storage medium storing program for executing, and the readable storage medium storing program for executing includes flash memory, hard
Disk, multimedia card, card-type memory (for example, SD or DX memory etc.), magnetic storage, disk, CD etc..Memory is one
It can be the internal storage unit of intra prediction mode decision device, such as the intra prediction mode decision device in a little embodiments
Hard disk.Memory is also possible to the External memory equipment of equipment, such as intra prediction mode judgement in further embodiments
The plug-in type hard disk being equipped in equipment, intelligent memory card (Smart Media Card, SMC), secure digital (Secure
Digital, SD) card, flash card (Flash Card) etc..Further, memory can also both be sentenced including intra prediction mode
Certainly the internal storage unit of equipment also includes External memory equipment.Memory can be not only used for storage and be installed on intra prediction mould
Application software and Various types of data, such as the code of intra prediction mode ordo judiciorum of formula decision device etc. can be also used for temporarily
When store the data that has exported or will export.
Processor can be in some embodiments a central processing unit (Central Processing Unit, CPU),
Controller, microcontroller, microprocessor or other data processing chips, program code or place for being stored in run memory
Manage data, such as execute intra prediction mode ordo judiciorum etc..
For the bus for connecting processor and memory, bus can be Peripheral Component Interconnect standard (peripheral
Component interconnect, abbreviation PCI) bus or expanding the industrial standard structure (extended industry
Standard architecture, abbreviation EISA) bus etc..The bus can be divided into address bus, data/address bus, control always
Line etc..
Further, intra prediction mode decision device can also include network interface, for receiving input to be compressed
Video data etc. after the completion of video and output compression.Here network interface optionally may include wireline interface and/or
Wireless interface (such as WI-FI interface, blue tooth interface), commonly used in establishing communication link between the equipment and other electronic equipments
It connects.
Optionally, which can also include user interface, and user interface may include display (Display), input
Unit such as keyboard (Keyboard), optional user interface can also include standard wireline interface and wireless interface.It is optional
Ground, in some embodiments, display can be light-emitting diode display, liquid crystal display, touch-control liquid crystal display and OLED
(Organic Light-Emitting Diode, Organic Light Emitting Diode) touches device etc..Wherein, display can also be appropriate
Referred to as display screen or display unit, for be shown in the information handled in intra prediction mode decision device and for show can
Depending on the user interface changed.
In the present embodiment, intra prediction mode decision device can be PC (Personal Computer, personal electricity
Brain), it is also possible to the terminal devices such as smart phone, tablet computer, palm PC, portable computer.Preferably, equipment is composition
The node of content distributing network CDN network or block chain network.
The present invention also provides a kind of computer readable storage medium, computer is stored on computer readable storage medium
Program, when computer program is executed by processor the step of the realization such as intra prediction mode decision method of any of the above item.
If the module in the intra prediction mode judgment device of the aforementioned offer of the present invention is in the form of software function module
Realize and when sold or used as an independent product, can store in a computer readable storage medium.Based on this
The understanding of sample, the technical solution of the application substantially the part that contributes to existing technology or the technical solution in other words
Completely or partially it can be embodied in the form of software products, which is stored in a storage medium,
It uses including some instructions so that a computer equipment (can be personal computer, server or the network equipment etc.) is held
The all or part of the steps of each embodiment the method for row the application.And storage medium above-mentioned include: USB flash disk, mobile hard disk,
Read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), magnetic
The various media that can store program code such as dish or CD.
The present invention also provides a kind of computer program products, which is characterized in that including computer instruction, when it is being calculated
When running on machine, computer is allowed to execute intra prediction mode decision method described in above-mentioned any of the above item.
The computer program product includes one or more computer instructions.Load and execute on computers the meter
When calculation machine program instruction, entirely or partly generate according to process or function described in the embodiment of the present invention.The computer can
To be general purpose computer, special purpose computer, computer network or other programmable devices.The computer instruction can be deposited
Storage in a computer-readable storage medium, or from a computer readable storage medium to another computer readable storage medium
Transmission, for example, the computer instruction can pass through wired (example from a web-site, computer, server or data center
Such as coaxial cable, optical fiber, Digital Subscriber Line (DSL)) or wireless (such as infrared, wireless, microwave) mode to another website
Website, computer, server or data center are transmitted.The computer readable storage medium can be computer and can deposit
Any usable medium of storage either includes that the data storages such as one or more usable mediums integrated server, data center are set
It is standby.The usable medium can be magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or partly lead
Body medium (such as solid state hard disk Solid State Disk (SSD)) etc..
In several embodiments provided herein, it should be understood that disclosed device, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the module
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple module or components
It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or
The mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or module
It closes or communicates to connect, can be electrical, mechanical or other forms.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real
It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.