ExtendedBilateral

From Avisynth wiki
Jump to: navigation, search
Abstract
Author insanedesio
Version v0.5.0.3
Download extendedbilateral_5F25_dll_20050622.zip
Category Spatial-Temporal Denoisers
License GPLv2
Discussion Doom9 Thread


Contents

[edit] Description

ExtendedBilateral extends the regular bilateral filtering process by adding an "initial estimation preprocess." It is similar in operation to TBilateral and offers many of the same options (though not all) while adding the preprocess.

It can also be used in conjunction with TBilateral if so need be. The filter is based on formulae given in Non-Iterative, Robust Monte Carlo Noise Reduction and The Bilateral Median Filter.

[edit] Requirements


[edit] Syntax and Parameters

FUNCTION TEMPLATE
-----------------
ExtendedBilateral(bool sup, int preprocess, int estimator, int final, int kernelD, int kernelR,
		  int diameterL, int diameterC, float sigmaDL, float sigmaDC, float sigmaRL,
		  float sigmaRC, float cwL, float cwC, bool chroma)


PARAMETER DESCRIPTIONS
----------------------

bool sup	If set to "true," chroma values are simply copied when upsampling from YUYV data to
		YUV data.  This doesn't really give much of a speed advantage, but if you know you
		want that kind of upsampling then you at least have the option.  If set to "false,"
		the "correct" 1-1 kernel is used in upsampling, as described on the sampling page at
		avisynth.org.  Basically you'd only change this parameter if you knew you wanted the
		simple chroma-copy upsampling.
	Default value:	false

int preprocess	This controls the presence of the preprocess.  Options:
		0	preprocess only (useful if using with TBilateral via its ppClip parameter)
		1	main process only (straight bilateral filter)
		2	preprocess and main process together
		Note that if using the preprocess in conjunction with TBilateral, all parameters that
		have corresponding equivalents in TBilateral should be set to the same values in both
		filters; values a little closer to the defaults for ExtendedBilateral will be better,
		as the preprocess adds extra smoothing on its own.

	Restrictions:	must be between zero and two inclusive.
	Default value:	2

int estimator	This controls the "initial estimation preprocess." Options:
		0	mean
		1	median
		2	centre-weighted median with centre weight equal to diameterL/diameterC
		3	kernel-based		

	Restrictions:	must be between zero and three inclusive.
	Default value:	3

int final	In the final step of the bilateral filter, a weighted average is performed.  This controls
		what the final step is.  Options:
		0	Weighted average
		1	Weighted-window median (the regular weights are applied and then a median of the
			window is performed).
		2	Weighted-window with centre weight median (same as weighted-window median except
			the centre pixel is given a weight equal to diameterL/diameterC)

	Restrictions: must be between zero and two inclusive.
	Default value: 0

bool chroma	This enables filtering on the chroma values.  If set to "false," only the luma values
		are processed and the chroma values are simply copied over.

	Default value: true

int kernelD	These control the domain and range kernels used.  These are mostly from the second paper
    kernelR	mentioned in the "General Information" section.  That paper has more information on the
		on the kernels and also suggested radii (diameter - 1 all divided by two) given a sigmaD
		value, which I have added here using corresponding diameters.  These should serve as
		approximate relationship indicators.  I pretty much took what that paper had verbatim and
		put it here, except for the ones for which I could figure out a more detailed process to
		determine a good diameter (adapted from the first paper).  I also changed it from sigmaR to
		sigmaD since sigmaD is a spatial deviation and sigmaR probably really wouldn't have too of
		an effect on a good diameter value, which is a spatial value.  (!) indicates a diameter
		value that is probably too high to be practical and thus a (much) lower value should be
		used.  Options:
		0	Andrew's Wave
				Given a sigmaD value, just round up (if fractional), double, and add one.
				So for the default of 0.4, round up to get 1, double to get 2, then add one
				to get 3.  For higher values of sigmaD, use a diameter smaller than the one
				calculated by the said method.
		1	Cosine
				Given a sigmaD value, just round up (if fractional), double, and add one.
				So for the default of 0.4, round up to get 1, double to get 2, then add one
				to get 3.  For higher values of sigmaD, use a diameter smaller than the one
				calculated by the said method.
		2	El-Fallah Ford
				For sigmaD = 10, use diameter 41 (!).
		3	Flat
				Given a sigmaD value, just round up (if fractional), double, and add one.
				So for the default of 0.4, round up to get 1, double to get 2, then add one
				to get 3.  For higher values of sigmaD, use a diameter smaller than the one
				calculated by the said method.
		4	Gaussian
				This is the kernel used in a regular bilateral filter. Given a sigmaD
				value, just triple, round up, double, and then finally add one to get a
				good diameter.  So for the default 0.4, triple to get 1.2, round up to get
				2, double to get 4, then add one to get the default diameter of 5.  Note
				that this works best for smaller values of sigmaD (less than about 1.33).
				For higher values of sigmaD, use a diameter smaller than the one calculated
				by the said method by 2 or 4, or more even for higher values of sigmaD
				(though really sigmaD values shouldn't be that high).
		5	Huber's Mini-Max
				For sigmaD = 1, use diameter 41 (!).
		6	Lorentzian
				For sigmaD = sqrt(2), use diameter 35 (!).
		7	Tukey's Bi-Weight
				Given a sigmaD value, just round up (if fractional), double, and add one.
				So for the default of 0.4, round up to get 1, double to get 2, then add one
				to get 3.  For higher values of sigmaD, use a diameter smaller than the one
				calculated by the said method.

	Restrictions: must be betwen zero and seven inclusive.
	Default value:	kernelD: 4
			kernelR: 4

int diameterL	These define the window around the current pixel that is used to determine the new
    diameterC	pixel value.  This implies that the larger the value, the slower the filter.
		"diameterL" is for luma and "diameterC" is for chroma.  These are the same as the
		"diameterL" and "diameterC" parameters in TBilateral.

	Restrictions:	must be an odd number greater than one.
	Recommendation:	Diameter according to suggestions and relationships for whatever kernel is used,
			if any.  Try also to set both diameterL and diameterC to the same value; using
			different values results in adding an extra set of loops per pixel.
	Default value:	diameterL: 5
			diameterC: 5

float sigmaDL	These are the domain (spatial) deviations.  As this is increased, spatially distant
      sigmaDC	pixels gain weight (i.e. they contribute more to the current pixel).  This means
		more smoothing.  "sigmaDL" is for luma and "sigmaDC" is for chroma.  These are the
		same as the "sDevL" and "sDevC" parameters in TBilateral.

	Restrictions:	must be greater than zero.
	Default value:	0.4

float sigmaRL	These are the range (intensity) deviations.  As this is increased, pixels differing
      sigmaRC	in intensity gain weight (i.e. they contribute more to the current pixel).  This
		means more smoothing.  "sigmaRL" is for luma and "sigmaRC" is for chroma.  These are
		the same as the "iDevL" and "iDevC" parameters in TBilateral.

	Restrictions:	must be greater than zero.
	Default value:	2.0

float cwL	These are the centre pixel's weights.  Before adding the pixel's weighted value to the
      cwC	weighted sum, it is multiplied by these values.  These are used whenever the domain and
		range kernels are used, so they are used in the preprocess when estimator = 3 and they
		are always used in the main process.  "cwL" is for luma and "cwC" is for chroma.  These
		are the same as the "csL" and "csC" parameters in TBilateral.

	Restrictions:	must be greater than or equal zero.
	Default value:	1.0


[edit] Changelog

0.5.0.3		-Fixed a small bug in the upsampling routine that slowed the filter down quite a bit.
(22/06/05)	 In my tests with the preprocessor alone, speed went from 5 fps to 6 fps which is about
		 a 20% speed increase (only one sig. dig. so actual increase could've been more than 1
		 fps - upto 1.9 fps I guess which in that specific case would be a 42% increase).  Thanks
		 to tritical for pointing it out.

0.5.0.2		-Added a LUT for the range kernels, giving a significant speed increase in the main
(18/06/05)	 bilateral process (about eight times faster in my tests), thanks to tritical's
		 suggestion.  Of course, that isn't saying much since it was slow as a bitch before.
		-First public release.

0.5.0.1		+Added multiple range/domain kernels via the "kernelD" and "kernelR" parameters.
(17/06/05)	+Added the "final" parameter to allow choosing between a weighted average and two
		 median variations as the final step in the bilateral filtering process.
		-Changed a couple of things of internally (might result in a 0.01% speedup :p).

0.3.1.2		-First version that works without errors and gives seemingly correct output.
(15/06/05)

TO-DO LIST
----------
1) Get rid of the upsampling (also tritical's suggestion).
2) Speed ups where possible.
3) Bug fixes as needed.


[edit] Archived Downloads

Version Download Mirror
v0.5.0.3 extendedbilateral_5F25_dll_20050622.zip extendedbilateral_5F25_dll_20050622.zip


[edit] External Links




Back to External Filters

Personal tools