Summary of the invention
In view of this, this application provides a kind of method and the device of removing blocking effect, for solving the problem affecting Consumer's Experience that image block effect causes.
To achieve these goals, the existing scheme proposed is as follows:
Remove a method for blocking effect, comprising:
S1, encoder export image in select an encoding block, be defined as pending encoding block;
S2, calculate the brightness average of the brightness average of described pending encoding block, each neighbours' encoding block of described pending encoding block;
S3, judge whether to there is target base encoding block, the absolute value of the difference of the brightness average of described target base encoding block and described pending encoding block is greater than pre-set threshold value; If so, perform step S4, if not, perform step S5;
S4, adjust the brightness of each pixel in described pending encoding block;
S5, judge whether satisfied following condition: in the image that encoder exports, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value; If so, then terminate, if not, then perform step S6;
S6, encoder export image in select next encoding block, this encoding block is defined as pending encoding block, and return perform step S2.
Preferably, the brightness of each pixel in the described pending encoding block of described adjustment, comprising:
Calculate the difference DELTA X of the brightness average of the brightness mean of mean X of each target base encoding block, described mean value X and described pending encoding block;
The brightness value of each pixel in described pending encoding block is all increased Δ X.
Remove a device for blocking effect, comprising:
First object selecting unit, for selecting an encoding block in the image that exports at encoder, is defined as pending encoding block;
Brightness average calculation unit, for calculating the brightness average of the brightness average of described pending encoding block, each neighbours' encoding block of described pending encoding block;
, there is target base encoding block for judging whether in the first judging unit, the absolute value of the difference of the brightness average of described target base encoding block and described pending encoding block is greater than pre-set threshold value;
Brightness adjustment unit, for when the judged result of described first judging unit is for being, adjusts the brightness of each pixel in described pending encoding block;
Second judging unit, for judging whether satisfied following condition: in the image that encoder exports, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value;
Second object selecting unit, for when the judged result of described second judging unit is no, selects next encoding block, this encoding block is defined as pending encoding block, and return the described brightness average calculation unit of execution in the image that encoder exports.
Preferably, described brightness adjustment unit comprises:
First brightness adjustment subelement, for calculating the difference DELTA X of the brightness average of the brightness mean of mean X of each target base encoding block, described mean value X and described pending encoding block;
Second brightness adjustment subelement, for all increasing Δ X by the brightness value of each pixel in described pending encoding block.
As can be seen from above-mentioned technical scheme, the method of the removal blocking effect of the application, an encoding block is selected in the image that encoder exports, be defined as pending encoding block, calculate the brightness average of the brightness average of this pending encoding block and each neighbours' encoding block of pending encoding block, judge whether to there is target base encoding block, the absolute value of the difference of the brightness average of this target base encoding block and described pending encoding block is greater than pre-set threshold value, if then adjust the brightness of each pixel in pending encoding block, and judging whether satisfied following condition: in the image that encoder exports, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value, if, then terminate, otherwise, next encoding block is selected in the image that encoder exports, this encoding block is redefined into pending encoding block, and return the process performing the brightness average calculating the brightness average of this pending encoding block and each neighbours' encoding block of pending encoding block.The application is by constantly searching the encoding block being greater than pre-set threshold value with the absolute value of the difference of the brightness average of neighbours' encoding block, and the brightness of pixel in this type of encoding block is regulated, in the image finally making encoder export, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value, also namely makes each encoding block all there is not blocking effect.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present application, be clearly and completely described the technical scheme in the embodiment of the present application, obviously, described embodiment is only some embodiments of the present application, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtained under creative work prerequisite, all belong to the scope of the application's protection.
See Fig. 1, Fig. 1 a kind of method flow diagram removing blocking effect disclosed in the embodiment of the present application.
As shown in Figure 1, the method comprises:
Step S1, encoder export image in select an encoding block, be defined as pending encoding block;
Step S2, calculate the brightness average of the brightness average of described pending encoding block, each neighbours' encoding block of described pending encoding block;
Particularly, each encoding block all comprises some pixels, and the brightness average of encoding block is the mean value of the brightness of all pixels in encoding block.
Neighbours' encoding block of pending encoding block can shown in reference diagram 2.If pending encoding block is encoding block 1, then its neighbours' encoding block can comprise encoding block 2 and/or encoding block 5.If pending encoding block is encoding block 2, then can to comprise in encoding block 1, encoding block 3, encoding block 6 any one or more for its neighbours' encoding block.If pending encoding block is encoding block 6, then can to comprise in encoding block 2, encoding block 5, encoding block 7, encoding block 10 any one or more for its neighbours' encoding block.Certainly, general, we select to be total to the encoding block on limit as its neighbours' encoding block with pending encoding block.
Step S3, judge whether to there is target base encoding block; If so, perform step S4, if not, perform step S5;
Particularly, the absolute value of the difference of the brightness average of described target base encoding block and described pending encoding block is greater than pre-set threshold value.Also namely, ask for the difference of the brightness average of target base encoding block and pending encoding block, and then judge whether the absolute value of this difference is greater than pre-set threshold value.
Step S4, adjust the brightness of each pixel in described pending encoding block;
Particularly, for the adjustment mode of the brightness of pixel each in pending encoding block, can comprise multiple, vide infra introduction in detail.
Step S5, judge whether satisfied first pre-conditioned; If so, then terminate, if not, then perform step S6;
Particularly, first is pre-conditionedly: in the image that encoder exports, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value.Also namely, if meet first pre-conditioned, then the embodiment of the present application thinks to there is not blocking effect in this width image.
Step S6, encoder export image in select next encoding block, this encoding block is defined as pending encoding block, and return perform step S2.
Particularly, when step S5 is judged as NO, also namely think when still there is blocking effect in this width image, in the image that encoder exports, select next encoding block, this encoding block is defined as pending encoding block.Wherein, next encoding block of selection is any one encoding block except the encoding block selected in step S1.The pending encoding block redefined is returned again and performs S2.
By the such scheme of the application, final reached target is also first pre-conditioned: in the image that encoder exports, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value.
It should be noted that, carrying out the again selected process of pending encoding block, for the purpose of simple, our putting in order generally according to encoding block, selects one by one.Certainly, other selection mode also belongs within the protection range of the application.
The method of the removal blocking effect of the application, an encoding block is selected in the image that encoder exports, be defined as pending encoding block, calculate the brightness average of the brightness average of this pending encoding block and each neighbours' encoding block of pending encoding block, judge whether to there is target base encoding block, the absolute value of the difference of the brightness average of this target base encoding block and described pending encoding block is greater than pre-set threshold value, if then adjust the brightness of each pixel in pending encoding block, and judging whether satisfied following condition: in the image that encoder exports, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value, if, then terminate, otherwise, next encoding block is selected in the image that encoder exports, this encoding block is redefined into pending encoding block, and return the process performing the brightness average calculating the brightness average of this pending encoding block and each neighbours' encoding block of pending encoding block.The application is by constantly searching the encoding block being greater than pre-set threshold value with the absolute value of the difference of the brightness average of neighbours' encoding block, and the brightness of pixel in this type of encoding block is regulated, in the image finally making encoder export, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value, also namely makes each encoding block all there is not blocking effect.
In another embodiment of the application, we introduce above-mentioned steps S4, adjust several implementations of the brightness of each pixel in described pending encoding block.
The first, see Fig. 3, Fig. 3 a kind of method flow diagram adjusting each pixel brightness in pending encoding block disclosed in the embodiment of the present application.
As shown in Figure 3, the method comprises:
The difference DELTA X of the brightness average of step S41, the brightness mean of mean X calculating each target base encoding block, described mean value X and described pending encoding block;
Step S42, the brightness value of each pixel in described pending encoding block is all increased Δ X.
Illustrate said process:
Still see Fig. 2, suppose that pending encoding block is encoding block 6, its neighbours' encoding block is encoding block 2,5,7 and 10.Pre-set threshold value is 3; The brightness average of encoding block 6 is 5, and the brightness average of encoding block 2 is 8, and the brightness average of encoding block 5 is 6, and the brightness average of encoding block 7 is 9, and the brightness average of encoding block 10 is 13.Then calculate and knownly only have the absolute value of the difference of the brightness average of encoding block 2,7,10 and encoding block 6 to be greater than pre-set threshold value 3, therefore encoding block 2,7,10 is defined as target base encoding block.
Brightness mean of mean X=(the 8+9+13)/3=10 of calculation code block 2,7,10;
The difference DELTA X=10-5=5 of the brightness average of calculating mean value X and encoding block 6.
The brightness value of each pixel in encoding block 6 is all increased by 5.
The second:
In each target base encoding block, pick out the target base encoding block that brightness average mediates, calculate the difference DELTA X of the brightness average of this target base encoding block and pending encoding block;
The brightness value of each pixel in described pending encoding block is all increased Δ X.
It should be noted that, if in each target base encoding block, the target base encoding block that brightness average mediates has two, then the mean value of wherein any one or two can be selected as standard, calculate the difference of the brightness average of this standard and pending encoding block.Such as, target base encoding block has 4, and brightness average is respectively 2,3,4,5, then can select using 3 or 4 or (3+4)/2=3.5 as standard.
Illustrate said process:
Still see Fig. 2, suppose that pending encoding block is encoding block 6, its neighbours' encoding block is encoding block 2,5,7 and 10.Pre-set threshold value is 3; The brightness average of encoding block 6 is 5, and the brightness average of encoding block 2 is 8, and the brightness average of encoding block 5 is 6, and the brightness average of encoding block 7 is 9, and the brightness average of encoding block 10 is 13.Then calculate and knownly only have the absolute value of the difference of the brightness average of encoding block 2,7,10 and encoding block 6 to be greater than pre-set threshold value 3, therefore encoding block 2,7,10 is defined as target base encoding block.
Because the brightness average of encoding block 2,7,10 is respectively 8,9,13, therefore select encoding block 7 as standard, the difference DELTA X=9-5=4 of the brightness average of calculation code block 7 and encoding block 6.
The brightness value of each pixel in encoding block 6 is all 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.Be understandable that, in addition can also comprise other multiple implementation, revise two implementations of extending a little by the application's scheme and also should belong within the protection range of the application.
Be described the device of the removal blocking effect that the embodiment of the present application provides below, the device of removal blocking effect described below can mutual corresponding reference with the method for above-described removal blocking effect.
See Fig. 4, Fig. 4 a kind of apparatus structure schematic diagram removing blocking effect disclosed in the embodiment of the present application.
As shown in Figure 4, this device comprises:
First object selecting unit 41, for selecting an encoding block in the image that exports at encoder, is defined as pending encoding block;
Brightness average calculation unit 42, for calculating the brightness average of the brightness average of described pending encoding block, each neighbours' encoding block of described pending encoding block;
, there is target base encoding block for judging whether in the first judging unit 43, the absolute value of the difference of the brightness average of described target base encoding block and described pending encoding block is greater than pre-set threshold value;
Brightness adjustment unit 44, for when the judged result of described first judging unit 43 is for being, adjusts the brightness of each pixel in described pending encoding block;
Second judging unit 45, for judging whether satisfied following condition: in the image that encoder exports, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value;
Second object selecting unit 46, for when the judged result of described second judging unit 45 is no, in the image that encoder exports, select next encoding block, this encoding block is defined as pending encoding block, and return the described brightness average calculation unit 42 of execution.
Optionally, the embodiment of the present application discloses a kind of alternate configurations of above-mentioned brightness adjustment unit, and as shown in Figure 5, brightness adjustment unit 44 can comprise:
First brightness adjustment subelement 441, for calculating the difference DELTA X of the brightness average of the brightness mean of mean X of each target base encoding block, described mean value X and described pending encoding block;
Second brightness adjustment subelement 442, for all increasing Δ X by the brightness value of each pixel in described pending encoding block.
The device of the removal blocking effect of the application, an encoding block is selected in the image that encoder exports, be defined as pending encoding block, calculate the brightness average of the brightness average of this pending encoding block and each neighbours' encoding block of pending encoding block, judge whether to there is target base encoding block, the absolute value of the difference of the brightness average of this target base encoding block and described pending encoding block is greater than pre-set threshold value, if then adjust the brightness of each pixel in pending encoding block, and judging whether satisfied following condition: in the image that encoder exports, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value, if, then terminate, otherwise, next encoding block is selected in the image that encoder exports, this encoding block is redefined into pending encoding block, and return the process performing the brightness average calculating the brightness average of this pending encoding block and each neighbours' encoding block of pending encoding block.The application is by constantly searching the encoding block being greater than pre-set threshold value with the absolute value of the difference of the brightness average of neighbours' encoding block, and the brightness of pixel in this type of encoding block is regulated, in the image finally making encoder export, the absolute value of the difference of the brightness average of any one encoding block neighbours encoding block each with it is all not more than pre-set threshold value, also namely makes each encoding block all there is not blocking effect.
Finally, also it should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operating space, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.
In this specification, each embodiment adopts the mode of going forward one by one to describe, and what each embodiment stressed is the difference with other embodiments, between each embodiment identical similar portion mutually see.
To the above-mentioned explanation of the disclosed embodiments, professional and technical personnel in the field are realized or uses the application.To be apparent for those skilled in the art to the multiple amendment of these embodiments, General Principle as defined herein when not departing from the spirit or scope of the application, can realize in other embodiments.Therefore, the application can not be restricted to these embodiments shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.