Andrei Frolov , Apr 12, 1999; 02:32 p.m.
What unsharp mask does is it takes value channel of the image, blurs that to specified degree to produce unsharp mask. That mask is then substracted from main image, and contrast is stretched to compensate. It works something like this: V' = (V - x*U)/(1 - x), where V is the value of the image pixel , U is the unsharp mask pixel, and x is degree of sharpening applied (0 .. 1.0). It should not be too dificult to implement using generic matrix transform. The only problem is that nice results are produced by the bigger blur radius, and you need big matrix to emulate that. It would be probably easier and faster to implement blur algorithm separately (say, like some sort of red-black sweep or something), and then mask as above.
If you want to try this, here is 3x3 toy model (with Gaussian blur):
( [ 0 0 0 ] [ 0.071 0.107 0.071 ] ) ( [ 0 1 0 ] - x * [ 0.107 0.290 0.107 ] ) / (1 - x) ( [ 0 0 0 ] [ 0.071 0.107 0.071 ] )I haven't tried this particular example, you tell me if it works :)...

