View Single Post
Old 8th October 2002, 02:52   #16  |  Link
Leuf
Registered User
 
Join Date: Apr 2002
Posts: 67
Quote:
Originally posted by SansGrip


It also occurred to me that softening could be more aggressive in dark areas of the screen, and I set about writing a filter to do that. Then I realized that it's pointless making Yet Another Softener, so instead I'm working on a filter to selectively "mix" two clips based on luma thresholds. E.g.:

orig = AviSource(blah)
blur = orig.Blur(1).Blur(1).Blur(1)
orig.ThresholdMix(blur, 16, 35)

would replace dark areas (16-35 luma) with a heavily blurred version. I've got something working along these lines and the results seem promising, with the blurring hardly noticible (whether this will remain true when viewed on a TV screen is something I'll have to test).

Right now all the filter does is a straight pixel-for-pixel replacement, but ideally it would "feather" the edges to be less obvious (one scene with a neon sign surrounded by darkness didn't look too good, and nor do high-contrast titles).

Can anyone suggest an effective way to do this? I thought of checking a 3x3 block around the pixel in question and only "mixing in" the alternate frame if *all* the pixels in the block fall within the threshold, but this seems to slow it down a great deal (at least my implementation of it

Any suggestions (even "look at the source for xxx") would be greatly appreciated.
I've done something similar, though I did modify an existing filter rather than try to mix two clips together. What I did was take the source to the original smart smoother and add in a luma threshold. Worried about the border areas I originally planned to alpha blend the original and blurred together according to the luma value instead of 1 cutoff threshold. Just for testing I did it with a cutoff, but I found there wasn't a noticeable problem so I've been using it as is. I'm probably blurring less than you. But the way I would have done it is to have 2 thresholds, below the low threshold becomes 100% the blurred pixel, above the high threshold 100% the source, and between an alpha blend of the two. This is pretty cheap computationally, you can use a lookup table even if you like, and should do what you want.
Leuf is offline   Reply With Quote