Repository navigation
libhb: Initial implementation of Chroma Smooth filter. - #1957
Conversation
|
Some additional comparisons, full color and the a channel in Lab color, which is similar to the Cr channel in YCbCr. Enlarged 2x in both dimensions for comparison. I realize there's not much going on in the scene and not much color variety; I chose the scene to highlight the chroma rainbow on the fence, which flickers horribly in motion, since it's a particularly common problem and a difficult one to overcome with HandBrake's current filters. Using appropriate settings (current preset Very Strong, tune Medium seems to work well), there is no perceptible chroma rainbow or flickering in motion after filtering. This is a particularly bad source, so it's normal for stronger and wider settings to perform better. That said, I'll probably tweak the strength presets to be stronger. The weaker presets don't do much at all in the current iteration. Presets comparison (smoothing strength)Slideshow videos: Images (open full size in tabs to compare):
Tunes comparison (smoothing width)Slideshow videos: Images (open full size in tabs to compare):
|
|
No comments/concerns, or no time to review? |
|
Sorry, no time to review yet |
|
I updated the strengths and reduced the width of the Very Wide tune from 13 px to 11 px. Encoding times are for a single run, not an average. Suffice to say, there is essentially no speed impact on SD content with 6 cores / 12 threads. Unlike the previous examples, these are deinterlaced with EEDI2. You can see that stronger settings appear to lead to artifacts (creating or enhancing existing ones) in the grayscale chroma plane(s); however, viewing the full color images proves this still continues to further reduce the appearance of chroma noise, rainbows, and other prominent visual artifacts. Images (open full size in tabs to compare):
|
d106f9d to
4648a1b
Compare
|
Another very difficult analog tape source. Comparison in full color and the b channel in Lab color, which is similar to the Cb channel in YCbCr. Images (open full size in tabs to compare):
As you can see, Chroma Smooth significantly reduces banding that NLMeans does not. Together, the chroma is smooth and clean, relatively speaking. |
|
One more, a relatively clean animation source that suffers from chroma rainbows that flicker madly. NLMeans can't do anything about it, and with luma filtering enabled harms detail slightly. Chroma Smooth removes most of the rainbow and reduces the flicker to a tolerable minimum. The side effect to removing the worst annoyances is a small loss of saturation. Images (open full size in tabs to compare):
|
|
This are impressive results. I like your Chroma Smooth filter. I have some older movie sources, that would benefit from such a filter. |
jstebbins
left a comment
There was a problem hiding this comment.
I haven't tried to understand how it works. But code looks good. Just the 2 nits.
|
Have you run it through valgrind yet? I always do a valgrind run on a few seconds of video when messing with buffers or pretty much any large change. Caught a double free of an hb_dict_t in my avfilter PR that way 😉 |
|
Hmm, regarding luma_copy and chroma_smooth, why not just pass in the hb_buffer_t in and out instead of digging into the buffer details at the function call. Have the function split out the components it needs. |
|
I have not valgrinded this, yet. I believe I suggested it regarding the avfilter PR. Guess I should take my own advice. 😸 |
4e483fe to
ed4a2a3
Compare
|
Pushed some changes. I backed out the passing buffers idea because it's a bit involved to pass around the thread data properly, ends up being uglier. Would like to merge if all are satisfied. |
|
fine with me. |
|
Will the Chroma Smooth filter get an UI in HandBrake or is this for command line use only? |
|
Eventually. |
|
@bradleysepos Nice Job Man! Looks pretty good so far. Once you have time, you should keep on tweaking the filter to see if it's possible to get around the reduced saturation side effect since this is a very important post processing filter to me. Also, I recommend that you should assign the GUI implementation of the Chroma Smooth Filter to Version 1.4.0 milestone once that happens. I'll be looking forward to having this implemented in the next update ASAP. |







































Useful for resolving various color-related issues, especially with lower resolution content from analog sources, e.g. not great DVD and VHS sources.
The blurring/smoothing algorithm is the same as used by the unsharp filter.
Some under-the-hood aspects could be improved. Currently, the Y/Luma plane is copied in memory; it would be great if we had something like
hb_buffer_copy()for only one plane. Also, thread init allocates the same data for all three planes, where most of it is only needed for the chroma planes.Performance is stellar. In some cases the result may be preferable to what NLMeans does, and it's way faster.
Needs GUI implementation.
Test on:
Screenshots (If relevant):
Original, default CLI preset:
Chroma Smooth preset Very Strong, tune Very Wide: