The content of the invention
In view of this, this application provides a kind of method and device for removing blocking effect, for solving image blocking effect institute
Caused by influence user experience the problem of.
To achieve these goals, it is proposed that scheme it is as follows:
A kind of method for removing blocking effect, including:
S1, select an encoding block in the image of encoder output, is determined as pending encoding block;
S2, the luminance mean value for calculating the pending encoding block, the pending encoding block each neighbours' encoding block it is bright
Spend average;
S3, judge whether target base encoding block, the target base encoding block and the pending encoding block
The absolute value of the difference of luminance mean value is more than pre-set threshold value;If so, step S4 is performed, if it is not, performing step S5;
The brightness of each pixel in S4, the adjustment pending encoding block;
S5, judge whether to meet following condition:Any one encoding block is compiled with its each neighbour in the image of encoder output
The absolute value of the difference of the luminance mean value of code block is no more than pre-set threshold value;If so, then terminate, if it is not, then performing step S6;
S6, select next encoding block in the image of encoder output, which is determined as pending encoding block,
And return and perform step S2.
Preferably, the brightness for adjusting each pixel in the pending encoding block, including:
Calculate average value X, the average value X of the luminance mean value of each target base encoding block and the pending encoding block
Luminance mean value difference DELTA X;
The brightness value of each pixel in the pending encoding block is increased into Δ X.
A kind of device for removing blocking effect, including:
First object selecting unit, for selecting an encoding block in the image that encoder exports, is determined as treating
Handle encoding block;
Luminance mean value computing unit, for the luminance mean value for calculating the pending encoding block, the pending encoding block
Each neighbours' encoding block luminance mean value;
First judging unit, for judging whether target base encoding block, the target base encoding block with it is described
The absolute value of the difference of the luminance mean value of pending encoding block is more than pre-set threshold value;
Brightness adjustment unit, for when the judging result of first judging unit is is, adjusting the pending volume
The brightness of each pixel in code block;
Second judging unit, for judging whether to meet following condition:Any one in the image of encoder output encodes
The absolute value of the difference of the luminance mean value of block and its each neighbours' encoding block is no more than pre-set threshold value;
Second object selecting unit, for when the judging result of second judging unit is no, being exported in encoder
Image in select next encoding block, which is determined as pending encoding block, and return and perform the luminance mean value
Computing unit.
Preferably, the brightness adjustment unit includes:
First brightness adjustment subelement is the average value X of the luminance mean value for calculating each target base encoding block, described flat
The difference DELTA X of average X and the luminance mean value of the pending encoding block;
Second brightness adjustment subelement, for the brightness value of each pixel in the pending encoding block to be increased Δ X.
It can be seen from the above technical scheme that the method for the removal blocking effect of the application, in the image of encoder output
One encoding block of middle selection, is determined as pending encoding block, calculates the luminance mean value of the pending encoding block and wait to locate
The luminance mean value of each neighbours' encoding block of encoding block is managed, judges whether target base encoding block, the target base encoding block
It is more than pre-set threshold value with the absolute value of the difference of the luminance mean value of the pending encoding block, if then adjusting pending encoding block
In each pixel brightness, and judge whether to meet following condition:Encoder output image in any one encoding block and its
The absolute value of the difference of the luminance mean value of each neighbours' encoding block, if it is, terminating, otherwise, is being compiled no more than pre-set threshold value
Next encoding block is selected in the image of code device output, which is redefined as pending encoding block, and return to execution
Calculate the process of the luminance mean value of the luminance mean value of the pending encoding block and each neighbours' encoding block of pending encoding block.This
Application is more than the encoding block of pre-set threshold value by constantly searching with the absolute value of the difference of the luminance mean value of neighbours' encoding block, and
Brightness to pixel in such encoding block is adjusted, it is final so that in the image of encoder output any one encoding block with
The absolute value of the difference of the luminance mean value of its each neighbours' encoding block is no more than pre-set threshold value, namely each encoding block is not deposited
In blocking effect.
Embodiment
Below in conjunction with the attached drawing in the embodiment of the present application, the technical solution in the embodiment of the present application is carried out clear, complete
Site preparation describes, it is clear that described embodiments are only a part of embodiments of the present application, instead of all the embodiments.It is based on
Embodiment in the application, those of ordinary skill in the art are obtained every other without making creative work
Embodiment, shall fall in the protection scope of this application.
Referring to Fig. 1, Fig. 1 is a kind of method flow diagram for removing blocking effect disclosed in the embodiment of the present application.
As shown in Figure 1, this method includes:
Step S1, an encoding block is selected in the image of encoder output, is determined as pending encoding block;
Step S2, luminance mean value, each neighbours' encoding block of the pending encoding block of the pending encoding block are calculated
Luminance mean value;
Specifically, each encoding block includes some pixels, and the luminance mean value of encoding block is to own in encoding block
The average value of the brightness of pixel.
Neighbours' encoding block of pending encoding block may be referred to shown in Fig. 2.If pending encoding block is encoding block 1, then
Its neighbours' encoding block can include encoding block 2 and/or encoding block 5.If pending encoding block is encoding block 2, then its neighbour compiles
Code block can include any one or more in encoding block 1, encoding block 3, encoding block 6.If pending encoding block is coding
Block 6, then its neighbours' encoding block can be including any one or more in encoding block 2, encoding block 5, encoding block 7, encoding block 10.
Certainly, general, we select to be total to the encoding block on side as its neighbours' encoding block with pending encoding block.
Step S3, target base encoding block is judged whether;If so, step S4 is performed, if it is not, performing step S5;
Specifically, the target base encoding block and the absolute value of the difference of the luminance mean value of the pending encoding block are big
In pre-set threshold value.That is, asking for the difference of target base encoding block and the luminance mean value of pending encoding block, and then judge the difference
Whether the absolute value of value is more than pre-set threshold value.
Step S4, the brightness of each pixel in the pending encoding block is adjusted;
Specifically, for the adjustment mode of the brightness of each pixel in pending encoding block, a variety of, detailed ginseng can be included
See below introduction.
Step S5, judge whether to meet the first preset condition;If so, then terminate, if it is not, then performing step S6;
Specifically, the first preset condition is:Any one encoding block is encoded with its each neighbour in the image of encoder output
The absolute value of the difference of the luminance mean value of block is no more than pre-set threshold value.If that is, meet the first preset condition, the application
Embodiment thinks blocking effect is not present in the width image.
Step S6, next encoding block is selected in the image of encoder output, which is determined as pending volume
Code block, and return and perform step S2.
Specifically, it is defeated in encoder when step S5 is judged as NO, namely when thinking to still suffer from blocking effect in the width image
Next encoding block is selected in the image gone out, which is determined as pending encoding block.Wherein, next encoding block of selection
It is any one encoding block in addition to the encoding block selected in step S1.Returned again for the pending encoding block redefined
Receipt row S2.
By the such scheme of the application, the target finally reached is also the first preset condition:Encoder output
The absolute value of the difference of the luminance mean value of any one encoding block and its each neighbours' encoding block is no more than pre-set threshold value in image.
It should be noted that carrying out the again selected process of pending encoding block, for the sake of simplicity, we generally according to
Putting in order for encoding block, selects one by one.Certainly, other selection modes are fallen within the protection domain of the application.
The method of the removal blocking effect of the application, an encoding block is selected in the image of encoder output, is determined
For pending encoding block, the bright of the luminance mean value of the pending encoding block and each neighbours' encoding block of pending encoding block is calculated
Average is spent, judges whether target base encoding block, the brightness of the target base encoding block and the pending encoding block is equal
The absolute value of the difference of value is more than pre-set threshold value, if the brightness of each pixel in pending encoding block is then adjusted, and judgement is
It is no to meet following condition:The difference of any one encoding block and the luminance mean value of its each neighbours' encoding block in the image of encoder output
The absolute value of value is no more than pre-set threshold value, if it is, terminating, otherwise, is selected in the image of encoder output next
Encoding block, pending encoding block is redefined as by the encoding block, and return perform calculate the pending encoding block brightness it is equal
The process of the luminance mean value of each neighbours' encoding block of value and pending encoding block.The application is compiled by constantly searching with neighbours
The absolute value of the difference of the luminance mean value of code block is more than the encoding block of pre-set threshold value, and to the brightness of pixel in such encoding block
It is adjusted, any one encoding block and the luminance mean value of its each neighbours' encoding block in the final image that encoder is exported
The absolute value of difference is no more than pre-set threshold value, namely causes each encoding block that blocking effect is not present.
In another embodiment of the application, we introduce each picture in above-mentioned steps S4, the adjustment pending encoding block
Several implementations of the brightness of vegetarian refreshments.
The first, referring to Fig. 3, Fig. 3 is a kind of disclosed in the embodiment of the present application to adjust each pixel in pending encoding block
The method flow diagram of brightness.
As shown in figure 3, this method includes:
Step S41, average value X, the average value X for calculating the luminance mean value of each target base encoding block wait to locate with described
Manage the difference DELTA X of the luminance mean value of encoding block;
Step S42, the brightness value of each pixel in the pending encoding block is increased into Δ X.
Illustrate the above process:
Referring also to Fig. 2, it is assumed that pending encoding block is encoding block 6, its neighbours' encoding block is encoding block 2,5,7 and 10.In advance
If threshold values is 3;The luminance mean value of encoding block 6 is 5, and the luminance mean value of encoding block 2 is 8, and the luminance mean value of encoding block 5 is 6, coding
The luminance mean value of block 7 is 9, and the luminance mean value of encoding block 10 is 13.Then calculate and understand only encoding block 2,7,10 and encoding block 6
The absolute value of the difference of luminance mean value is more than pre-set threshold value 3, therefore encoding block 2,7,10 is determined as target base encoding block.
Average value X=(8+9+13)/3=10 of the luminance mean value of calculation code block 2,7,10;
Calculate the difference DELTA X=10-5=5 of average value X and the luminance mean value of encoding block 6.
The brightness value of each pixel in encoding block 6 is increased by 5.
Second:
The target base encoding block that luminance mean value is in middle is picked out in each target base encoding block, calculates the target
The difference DELTA X of neighbours' encoding block and the luminance mean value of pending encoding block;
The brightness value of each pixel in the pending encoding block is increased into Δ X.
If it should be noted that in each target base encoding block, luminance mean value is in middle target base encoding block
There are two, then the average value of wherein any one or two can be selected to calculate the standard and pending coding as standard
The difference of the luminance mean value of block.For example, target base encoding block has 4, luminance mean value is respectively 2,3,4,5, then can select
Using 3 or 4 or (3+4)/2=3.5 as standard.
Illustrate the above process:
Referring also to Fig. 2, it is assumed that pending encoding block is encoding block 6, its neighbours' encoding block is encoding block 2,5,7 and 10.In advance
If threshold values is 3;The luminance mean value of encoding block 6 is 5, and the luminance mean value of encoding block 2 is 8, and the luminance mean value of encoding block 5 is 6, coding
The luminance mean value of block 7 is 9, and the luminance mean value of encoding block 10 is 13.Then calculate and understand only encoding block 2,7,10 and encoding block 6
The absolute value of the difference of luminance mean value is more than pre-set threshold value 3, therefore encoding block 2,7,10 is determined as target base encoding block.
Since the luminance mean value of encoding block 2,7,10 is respectively 8,9,13, select encoding block 7 to be used as standard, calculate and compile
The difference DELTA X=9-5=4 of code block 7 and the luminance mean value of encoding block 6.
The brightness value of each pixel in encoding block 6 is increased by 4.
The mode of the brightness of each pixel in two kinds of pending encoding blocks of adjustment is merely illustrated in the present embodiment.It can manage
Solution, in addition can also include other a variety of implementations, by application scheme two realization extended with minor modifications
Mode should also belong within the protection domain of the application.
The device of removal blocking effect provided by the embodiments of the present application is described below, removal blocking effect described below
Device with it is above-described removal blocking effect method can correspond reference.
Referring to Fig. 4, Fig. 4 is a kind of apparatus structure schematic diagram for removing blocking effect disclosed in the embodiment of the present application.
As shown in figure 4, the device includes:
First object selecting unit 41, for selecting an encoding block in the image that encoder exports, is determined as
Pending encoding block;
Luminance mean value computing unit 42, for the luminance mean value for calculating the pending encoding block, the pending coding
The luminance mean value of each neighbours' encoding block of block;
First judging unit 43, for judging whether target base encoding block, the target base encoding block and institute
The absolute value for stating the difference of the luminance mean value of pending encoding block is more than pre-set threshold value;
Brightness adjustment unit 44, for when the judging result of first judging unit 43 is is, waiting to locate described in adjustment
Manage the brightness of each pixel in encoding block;
Second judging unit 45, for judging whether to meet following condition:Any one in the image of encoder output is compiled
The absolute value of the difference of the luminance mean value of code block and its each neighbours' encoding block is no more than pre-set threshold value;
Second object selecting unit 46, for second judging unit 45 judging result for it is no when, in encoder
Next encoding block is selected in the image of output, which is determined as pending encoding block, and returns and performs the brightness
Average calculation unit 42.
Optionally, the embodiment of the present application discloses a kind of alternative construction of above-mentioned brightness adjustment unit, as shown in figure 5, bright
Degree adjustment unit 44 can include:
First brightness adjustment subelement 441, the average value X of the luminance mean value for calculating each target base encoding block, institute
State the difference DELTA X of average value X and the luminance mean value of the pending encoding block;
Second brightness adjustment subelement 442, for the brightness value of each pixel in the pending encoding block to be increased
ΔX。
The device of the removal blocking effect of the application, an encoding block is selected in the image of encoder output, is determined
For pending encoding block, the bright of the luminance mean value of the pending encoding block and each neighbours' encoding block of pending encoding block is calculated
Average is spent, judges whether target base encoding block, the brightness of the target base encoding block and the pending encoding block is equal
The absolute value of the difference of value is more than pre-set threshold value, if the brightness of each pixel in pending encoding block is then adjusted, and judgement is
It is no to meet following condition:The difference of any one encoding block and the luminance mean value of its each neighbours' encoding block in the image of encoder output
The absolute value of value is no more than pre-set threshold value, if it is, terminating, otherwise, is selected in the image of encoder output next
Encoding block, pending encoding block is redefined as by the encoding block, and return perform calculate the pending encoding block brightness it is equal
The process of the luminance mean value of each neighbours' encoding block of value and pending encoding block.The application is compiled by constantly searching with neighbours
The absolute value of the difference of the luminance mean value of code block is more than the encoding block of pre-set threshold value, and to the brightness of pixel in such encoding block
It is adjusted, any one encoding block and the luminance mean value of its each neighbours' encoding block in the final image that encoder is exported
The absolute value of difference is no more than pre-set threshold value, namely causes each encoding block that blocking effect is not present.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by
One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation
Between there are any actual relationship or order.Moreover, term " comprising ", "comprising" or its any other variant meaning
Covering non-exclusive inclusion, so that process, method, article or equipment including a series of elements not only include that
A little key elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or
The intrinsic key element of equipment.In the absence of more restrictions, the key element limited by sentence "including a ...", is not arranged
Except also there are other identical element in the process, method, article or apparatus that includes the element.
Each embodiment is described by the way of progressive in this specification, what each embodiment stressed be and other
The difference of embodiment, between each embodiment identical similar portion mutually referring to.
The foregoing description of the disclosed embodiments, enables professional and technical personnel in the field to realize or using the application.
A variety of modifications to these embodiments will be apparent for those skilled in the art, as defined herein
General Principle can be realized in other embodiments in the case where not departing from spirit herein or scope.Therefore, the application
The embodiments shown herein is not intended to be limited to, and is to fit to and the principles and novel features disclosed herein phase one
The most wide scope caused.