System and method for edge sharpening

Presented herein are a system and method for sharpening edges in a region. In one embodiment, there is presented a method for sharpening edges. The method comprises measuring differences between at least a value associated with a first pixel and a value associated with a second pixel of a plurality of pixels; and applying a sharpening mask to the plurality of pixels, wherein the sharpening mask is a function of at least one of the measured differences, a first value associated with any one of the plurality of pixels, and a second value associated with any other of the pixels, thereby resulting in sharpened pixels.

RELATED APPLICATIONS

This application is related to SYSTEM AND METHOD FOR CORRECTING CHROMA PIXELS, application Ser. No. 11/563,457, filed Nov. 27, 2006, which is incorporated herein by reference for all purposes.

FEDERALLY SPONSORED RESEARCH OR DEVELOPMENT

Not Applicable

Not Applicable

BACKGROUND OF THE INVENTION

Sharpening can be used to partially correct blurry video. Video blurriness can be caused by a variety of factors, such as an improperly focused lens and scaling. Sharpening attempts to emphasize edges in the video picture.

There are several drawbacks that can occur when sharpening. For example, sharpening can also emphasize noise. Additionally, sharpening can inappropriately sharpen smooth color transitions. Additionally, sharpening can overemphasize edges.

BRIEF SUMMARY OF THE INVENTION

A system and/or method is provided for sharpening edges substantially as shown in and/or described in connection with at least one of the figures, as set forth more completely in the claims.

These and other features and advantages of the present invention may be appreciated from a review of the following detailed description of the present invention, along with the accompanying figures in which like reference numerals refer to like parts throughout.

DETAILED DESCRIPTION OF THE INVENTION

Referring now toFIG. 1, there is illustrated a block diagram for sharpening video data in accordance with an embodiment of the present invention. The video data comprises a series of pictures100. A picture100comprises at least one grid of pixels,105(x,y). Each pixel105is associated with a particular value. The particular value can identify or indicate a color for the pixel105.

The clarity of the picture100can be improved by application of a sharpening mask110. The sharpening mask110sharpens certain edges that appear in the picture100, thereby improving the quality of video. However, application of a sharpening mask can also create false edges where smooth color transitions occur and emphasize noise.

Accordingly, the sharpening mask110dynamically adjusts to the picture100. The sharpening mask110is applied to a region115of the picture100. The sharpening mask110is a function of values associated with at least two of the pixels, e.g.,105(a,b) and105(c,d) in the region115, and a difference of the values between two pixels, e.g.,105(e,f) and105(g,h).

Referring now toFIG. 2, there is illustrated a flow diagram for sharpening video data in accordance with an embodiment of the present invention.FIG. 3is a block diagram of an exemplary circuit for sharpening video data in accordance with an embodiment of the present invention.

The flow chart ofFIG. 2will be described in connection with the circuit ofFIG. 3. At205, measuring circuit305measures differences in values between at least two pixels in a region, e.g.,105(e,f) and105(g,h). At210, a masking circuit310applies a sharpening mask to the pixels in the region. The sharpening mask110is a function the difference between values for pixels105(e,f) and105(g,h), and the values associated with two pixels, e.g.,105(a,b) and105(c,d). The measuring circuit305can receive the values associated with the pixels105and provide the difference between values for pixels105(e,f) and105(g,h), as well as the values associated with the two pixels105(a,b) and105(c,d).

In certain embodiments of the present invention, the two pixels105(a,b) and105(c,d) can be associated with the highest and lowest values among all of the pixels105in the region120.

In certain embodiments of the present invention, the pixels105(e,f) and105(g,h) can be neighboring. The pixels105(e,f) and105(g,h) can be neighboring in either the horizontal direction or the vertical direction.

In certain embodiments of the present invention, the pixels105(e,f) and105(g,h) can have the highest differential between neighboring pairs of pixels. Additionally, in certain embodiments of the present invention, the sharpening mask110can be a function of more than one difference of pixels.

In certain embodiments of the present invention, the sharpening mask110can be a function of ratio of the sum of the differences in values between horizontal and/or vertical pairs of pixels105having the having the highest and second highest differential and the difference between the pixels having the highest and lowest pixel values in the region.

Referring now toFIG. 4, there is illustrated a block diagram of an exemplary region of a picture100. The region can comprise a block with a predetermined number of columns and rows. In an exemplary embodiment, the block may comprise seven columns and five rows. The following description will be illustrated with a block comprising seven columns and five rows, although it is noted that other embodiments of the present invention may use different numbers of columns and rows.

The region also includes 30 pairs of horizontally neighboring pixels405, and 28 pairs of vertically neighboring pixels. Each pair of horizontally neighboring pixels and vertically neighboring pixels has a difference between the values for the neighboring pixels.

One of the horizontally neighboring pairs has a highest difference between the values of the horizontally neighboring pixels. Another of the horizontally neighboring pairs has a second highest difference between the values of the horizontally neighboring pixels.

One of the vertically neighboring pairs of pixels has a highest difference between the values of the vertically neighboring pixels. Another of the vertically neighboring pixel pairs has a second highest difference between the values of the vertically neighboring pixels.

Additionally, the region comprises a pixel that is associated with the highest value and a pixel that is associated with the lowest value.

Referring now toFIG. 5A, there is illustrated a graph describing the strength of the sharpening mask110that is applied to the region in accordance with an embodiment of the present invention. In certain embodiments of the present invention, the amount of sharpening that is applied to the portion120is a function of the ratio:

Ratio=Max+⁢Omaxmaxval-minval
where:maxval=The highest value associated with a pixel in the regionminval=The lowest value associated with any pixel in the regionMax=The maximum difference between two neighboring pixelsOmax=The 2ndhighest difference between two neighboring pixels

In certain embodiments, Max can be the maximum difference between any two horizontally neighboring pixels and the Omax can be the 2ndhighest difference between any two horizontally neighboring pixels.

In certain embodiments, Max can be the maximum difference between any two vertically neighboring pixels and the Omax can be the 2ndhighest difference between any two vertically neighboring pixels.

In certain embodiments of the present invention, the ratio can be the higher of the ratios that result from Max being the maximum difference between any two horizontally neighboring pixels and the Omax being the 2ndhighest difference between any two horizontally neighboring pixels, and Max being the maximum difference between any two vertically neighboring pixels and Omax being the 2ndhighest difference between any two vertically neighboring pixels.

Referring now toFIG. 5B, there is illustrated a graph of the pixel values describing an exemplary line of neighboring pixels. For illustrative purposes, the value422is the maximum value for the pixels maxval in the region, the value421is the minimum value minval for the pixels in the region. The difference between values425and424is the maximum neighboring pixel difference, max. The difference between values424and423is the second maximum neighboring pixel difference, omax. The ratio is slightly less than unity. Thus the sharpening mask applies a moderate amount of sharpening to the pixels.

Referring now toFIG. 5C, there is illustrated a graph of the pixel values describing another exemplary line of neighboring pixels. For illustrative purposes, the value433is the maximum value for the pixels maxval in the region, the value431is the minimum value minval for the pixels in the region. The difference between values435and434is the maximum neighboring pixel difference, max. The difference between values434and433is the second maximum neighboring pixel difference, omax. The ratio will be low, and thus the sharpening mask applies a higher amount of sharpening to the pixels.

Referring now toFIG. 5D, there is illustrated a graph of the pixel values describing another exemplary line of neighboring pixels having impulse noise. Value444for a pixel is characteristic of impulse noise. For illustrative purposes, the value444is the maximum value for the pixels maxval in the region, the value441is the minimum value minval for the pixels in the region. The difference between values445and444is the maximum neighboring pixel difference, max. The difference between values444and443is the second maximum neighboring pixel difference, omax. The ratio will be higher than unity, and thus the sharpening mask applies very little sharpening to the pixels.

Application of a sharpening mask can cause peaking of certain pixels. Certain embodiments of the present invention can correct the peaking by scaling the oversharpened pixels.

Referring now toFIG. 6A, there is illustrated a graph of values for exemplary sharpened pixels in a line. Values600-605are for sharpened pixels. Values600-605are lower than that original minimum value, minval. Values611-615exceed the original maximum value, maxval. Values606-610are between the values of minval and maxval.

According to certain embodiments of the present invention, values600-605and611-615for sharpened pixels that are either lower than the original minimum value, minval, or exceed the original maximum value, maxval, are scaled towards either minval or maxval.

FIG. 6Bshows corrected values for sharpened pixels600-615in accordance with an embodiment of the present invention.

According to certain embodiments of the present invention, values606-610for sharpened pixels are not corrected for peaking.

In one embodiment, the sharpened values for the sharpened pixels are corrected as described by the following equations:

The correction value multiplied by the gain:

Referring now toFIG. 7A, there is illustrated a graph of chroma red705and chroma blue values710for exemplary pixels. The foregoing may be indicative of a blurry transition from a blue object to a red object.

FIG. 7Bis a graph of sharpened chroma red and chroma blue values for the exemplary pixels. As can be seen, the chroma red values705and chroma blue values710make sharp transitions. However, during the transition, there are periods where both the chroma red values705and chroma blue values710are high. This results in an undesirable saturation peak.

In certain embodiments of the present invention, the undesirable saturation peak is avoided by making changes to chroma red values contingent on changes to proximate chroma blue values and vice versa.

One embodiment of the present invention can use the equations below to makes to the chroma red pixels and changes to the chroma blue pixels.

Cr & Cb individually multiplied by the gain:
(chroma)Correction=(Correction*CHROMA_GAIN)>>9
To help avoid false colors, limit corrections to Cr & Cb when simultaneous changes occur.

Referring now toFIG. 8, there is illustrated a block diagram describing an exemplary circuit in accordance with an embodiment of the present invention. The circuit comprises an interface805. The interface805provides pixel data to line buffers810. The line buffers810separate the luma pixels L, chroma red pixels Cr, and chroma blue pixels Cb.

The circuit815determines the maximum and minimum values for the 3×3 regions of the picture. Circuit825determines the maximum values, minimum values, maximum difference, and minimum difference for associated with pixels in each 7×5 region of the picture and provides the same to sharp edge avoidance circuit850.

The sharp edge avoidance circuit850uses the foregoing values to adapt the edge sharpening mask to sharpen each 7×5 portion. In different embodiments of the present invention, the sharp edge avoidance circuit850can use any and/or a combination of the edge sharpening techniques described herein.

The peaking and coring circuit852scales oversharpened luma pixels. In certain embodiments of the present invention, the peaking and coring circuit852uses any and/or a combination of the peaking techniques described herein.

Linear 4:2:2→4:4:4 conversion circuit835provides linearly interpolated chroma blue pixels Cb to a 7×5 filter855and circuit860. Circuit860determines the maximum and minimum values associated with pixels in 3×3 regions of the picture. The 7×5 filter provides the filtered chroma blue Cb pixels to a peak and false color avoidance circuit865. The circuit860provides the maximum and minimum values associated with the pixels in the 3×3 regions of the picture to the peak and false color avoidance circuit865.

Linear 4:2:2→4:4:4 conversion circuit845provides linearly interpolated chroma blue pixels Cb to a 7×5 filter875and circuit880. Circuit880determines the maximum and minimum values associated with pixels in 3×3 regions of the picture. The 7×5 filter875provides the filtered chroma blue Cb pixels to the peak and false color avoidance circuit865. The circuit880provides the maximum and minimum values associated with the pixels in the 3×3 regions of the picture to the peak and false color avoidance circuit865.

The peak and false color avoidance circuit865scales oversharpened chroma pixels and prevents false colors from appearing. In certain embodiments of the present invention, the peak and false color avoidance circuit865can use any or a combination of the techniques described here.

Referring now toFIG. 9, there is illustrated a block diagram of circuit815for determining the maximum and minimum values of a 3×3 region in accordance with an embodiment of the present invention. The circuit815comprises a memory905, a maximum comparator910, a minimum comparator915, a first register920, and a second register925.

The memory905provides pixel lines to the first and second registers915and920. The memory905and first register915provide values of three neighboring pixels to the maximum comparator910. The maximum comparator910outputs the maximum pixel values. The memory905and second register910provides values of three neighboring pixels to the minimum comparator915. The minimum comparator915outputs the minimum pixel values.

It is noted that the maximum and minimum comparators910and915can provide the maximum and minimum values in a variety of ways. In certain embodiments, the maximum and minimum comparators910and915can use bubble sorting. Alternatively, each of the three values, e.g., values A, B, and C, can be compared to others of the three values, e.g., [A,B], [A,C], and [B,C]. From the maximum and minimum values for each of the foregoing comparisons, the maximum and minimum values of A, B, and C can be determined.

In certain embodiments of the present invention, if there is a long list of small items, it can be faster and require less circuitry to use a bitwise search. In a bitwise search, all items are enabled. If any item has a most significant bit set, all items without the most significant bit set are disabled. Then if any items have the next most significant bit set, all items without the next most significant bit set are disabled. The foregoing is repeated until only one of the items is enabled.

Referring now toFIG. 10, there is illustrated a block diagram of an exemplary filter820in accordance with an embodiment of the present invention. The filter820comprises an all ones filter1005, blurring filters1010, an adder1015, and a selector1020.

The all ones filter1005applies a 35-tap (7 horizontal, 5 vertical) ones filter. An exemplary all ones filter is shown below:

The all ones filter can be separable and rasterizable. Each column can include four additions. Adding the seven columns uses six additions. Additionally, the all ones filter can be put in a “horizontal only mode” for luma and/or chroma. In horizontal only mode, the all ones filter collapses to

The blurring filters1010can include a plurality of selectable filters1010. Exemplary filters are shown below:

Referring now toFIG. 11, there is illustrated a block diagram describing a circuit for determining the maximum and second highest pixel value difference for a column in accordance with an embodiment of the present invention. The circuit comprises memory1105for storing pairs of horizontally neighboring pixels1110and vertically neighboring pixels1115.

A horizontal difference circuit1120determines the maximum max′ and second highest omax′ difference in values between the pairs of horizontally neighboring pixels1110in the column. A vertical difference circuit1125determines the maximum max′ and second highest omax′ difference in values between the pairs of vertically neighboring pixels1115in the column.

Scalars1130scales the maximum max′ and second highest omax′ differences among the horizontally neighboring pixels and vertically neighboring pixels in the columns. A sorting circuit1135sorts the maximum max′ and second highest omax′ differences among the horizontally neighboring pixels and vertically neighboring pixels in the column.

Referring now toFIG. 12Athere is illustrated a block diagram of an exemplary circuit for providing the maximum max and second highest omax differences in values between horizontally and vertically neighboring pixels. The circuit comprises a first register1205and a second register1210. The first register1205receives the maximum differences max′ from each column. The second register1210receives the second highest differences omax′ from each column. A sorting circuit1215provides the maximum max and second highest omax difference in values between horizontally and vertically neighboring pixels for a region.

Referring now toFIG. 12B, there is illustrated a block diagram of another exemplary circuit for providing the maximum max and second highest omax differences in values between horizontally and vertically neighboring pixels.

The circuit comprises a first register1205, second register1210, third register1215, and fourth register1220. Certain embodiments of the present invention can use a hierarchical sort. The first register1205and second register1210first sorts pairs of columns with a 4 way sort1212. Then the third register1215and fourth register1220sorts 4 pairs of columns with an 8 way sort1222.

Referring now toFIG. 13, there is illustrated a flow diagram for sharpening a picture in accordance with an embodiment of the present invention.

At1305, the maximum and minimum values associated with pixels in a region are determined. At1307, a determination is made whether the difference between maximum and minimum pixel values in the region exceed a predetermined threshold. If the maximum and minimum difference exceed the predetermined threshold, at1310, the maximum difference and second highest difference among the horizontally neighboring pairs is determined. At1315, the maximum difference and second highest difference among the vertically neighboring pairs is determined.

If at1307, the difference between the maximum and minimum values of pixels in the region do not exceed the predetermined threshold,1310-1335are bypassed, and1305is repeated for the next region.

At1320, a ratio is calculated between the sum of the maximum difference in values associated with the pixels in a region and the second highest difference in values associated with the horizontally neighboring pairs, and the difference between the maximum pixel value and the minimum pixel value. At1325, a ratio is calculated between the sum of the maximum difference in values associated with the pixels in a region and the second highest difference in values associated with the vertically neighboring pairs, and the difference between the maximum pixel value and the minimum pixel value.

At1330, a sharpening mask is applied to the pixels in the region as a function of the higher of the ratios between the ratios calculated during1320and1325. The sharpening mask is inversely related to the ratio, wherein the sharpening mask applies more sharpening where the ratio is lower and less sharpening where the ratio is high.

At1332, the sharpened pixels with values that exceed the maximum pixel value (determined at1305) and sharpened pixels with values that are lower than the minimum pixel value (determined at1305) are scaled while the sharpened pixels with values that are between the second value and the first pixel value are left alone. At1335, chroma red pixel values for sharpened pixels are corrected based on a blue pixel value for sharpened pixels, and vice versa, and1305is repeated for the next region.

The embodiments described herein may be implemented as a board level product, as a single chip, application specific integrated circuit (ASIC), or with varying levels of the system integrated with other portions of the system as separate components. Alternatively, if the processor is available as an ASIC core or logic block, then the commercially available processor can be implemented as part of an ASIC device wherein certain aspects of the present invention are implemented as firmware.

The degree of integration may primarily be determined by the speed and cost considerations. Because of the sophisticated nature of modern processors, it is possible to utilized a commercially available processor, which may be implemented external to an ASIC implementation.