Shadow Smoother filter for virtualdub - Copyright 2002 Valentim Batista This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. The author can be contacted at: Valentim Batista vb@timsara.freeservers.com timsara.freeservers.com
This filter was built to smooth (both spatial and temporal) the darkest parts of the
picture in order to reduce the bitrate needed to encode such dark areas. The smoothing
process runs row by row, each one by its own, without any vertical input.
The filter acts upon areas of variable radius in order to achieve 3 smoothing
strengths.
Version 0.5 in addition to the 0.4 version the filter will lock pixels (use the
previous frame pixel) that only differ half of the difference configured for the
temporal smoothing (0 for 0 and 1, 1 for 2 and 3, 2 for 4 and 5 and so on.
Threshold values effect are easily previewed (red/green option) and even difference
to a certain extent but difference values over 4/5 are known to generate artefacts
because the pixels that can be averaged generate visualy distinct areas from some
that are not and kind of "leave a trail".
On version 0.6 pixel locking if configurable and is added the possibility to lock
"noise" pixels (pixels not locked sided by locked pixels), besides this a post
smoothing is added to smooth the edges generated by discrete options (lock/blend).
On version 0.7 a bug with uneven (modulo<>0) widths was corrected.
Technical note: the contribution values for the three radius are 1/4,1/2,1/4; 1/8,1/4,1/4,1/4,1/8; 1/8,1/8,1/8,1/4,1/8,1/8,1/8;
Technical note: the contribution values for the post smoothing are 1/8,6/8,1/8.
The "show affected area as red/green" debug option shows spatial smoothed areas as negative/red and the temporal/spatial smoothed areas as negative/green. There is a threshold to control how much is considered shadows and a difference to specify the likeness necessary between pixels in frames so that they are elligible to be averaged (the excluded pixels appear as negative/red with the debug option on).
Technical note: the difference corresponds to the number of bit positions from the less significative that can be 1 on each channel (R, G and B), on a computed (exclusive-or between the two pixels) value, without excluding the pixel from the process.
Selecting the "show affected area as red/green" it is possible to see how much of the image will be smoothed, with 0 none and from that to 7, the higher threshold selecting the lighter shadow areas of the picture.
Technical note: the threshold corresponds to the number of bit positions from the less significative that can be 1 on each channel (R, G and B) without excluding the pixel from the process.
![]() | ![]() | ![]() |
Threshold=5 | Threshold=6 | Threshold=7 |
![]() | ![]() | ![]() |
Threshold=6, Strength=1 PNG: 20402 bytes | Threshold=6, Strength=2 PNG: 20194 bytes | Threshold=6, Strength=3 PNG: 20149 bytes |
![]() | ![]() | ![]() |
Threshold=7, Strength=1 PNG: 20168 bytes | Threshold=7, Strength=2 PNG: 19783 bytes | Threshold=7, Strength=3 PNG: 18842 bytes |
2002/03/17