mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	resample: use blackman with 0.232 alpha
Gives much better results with less aliasing.
This commit is contained in:
		
							parent
							
								
									4c27c3fd43
								
							
						
					
					
						commit
						cc996b6292
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -60,11 +60,13 @@ static inline double sinc(double x)
 | 
			
		|||
 | 
			
		||||
static inline double blackman(double x, double n_taps)
 | 
			
		||||
{
 | 
			
		||||
	double w = 2.0 * x * M_PI / n_taps + M_PI;
 | 
			
		||||
	return 0.3635819 - 0.4891775 * cos(w) +
 | 
			
		||||
		0.1365995 * cos(2 * w) - 0.0106411 * cos(3 * w);
 | 
			
		||||
	double alpha = 0.232;
 | 
			
		||||
	x =  2.0 * M_PI * x / n_taps;
 | 
			
		||||
	return (1.0 - alpha) / 2.0 + (1.0 / 2.0) * cos(x) +
 | 
			
		||||
		(alpha / 2.0) * cos(2 * x);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
static int build_filter(float *taps, uint32_t stride, uint32_t n_taps, uint32_t n_phases, double cutoff)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t i, j, n_taps12 = n_taps/2;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue