mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	channelmix: use average for center and LFE
Stops the LFE from clipping.
This commit is contained in:
		
							parent
							
								
									f6dbd75e61
								
							
						
					
					
						commit
						e353999028
					
				
					 1 changed files with 4 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -47,11 +47,11 @@ static inline void vol_c(float *d, const float *s, float vol, uint32_t n_samples
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void add_c(float *d, const float *s0, const float *s1, uint32_t n_samples)
 | 
			
		||||
static inline void avg_c(float *d, const float *s0, const float *s1, uint32_t n_samples)
 | 
			
		||||
{
 | 
			
		||||
	uint32_t n;
 | 
			
		||||
	for (n = 0; n < n_samples; n++)
 | 
			
		||||
		d[n] = s0[n] + s1[n];
 | 
			
		||||
		d[n] = (s0[n] + s1[n]) * 0.5f;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void sub_c(float *d, const float *s0, const float *s1, uint32_t n_samples)
 | 
			
		||||
| 
						 | 
				
			
			@ -211,14 +211,14 @@ channelmix_f32_2_3p1_c(struct channelmix *mix, void * SPA_RESTRICT dst[],
 | 
			
		|||
		if (mix->widen == 0.0f) {
 | 
			
		||||
			vol_c(d[0], s[0], v0, n_samples);
 | 
			
		||||
			vol_c(d[1], s[1], v1, n_samples);
 | 
			
		||||
			add_c(d[2], s[0], s[1], n_samples);
 | 
			
		||||
			avg_c(d[2], s[0], s[1], n_samples);
 | 
			
		||||
		} else {
 | 
			
		||||
			for (n = 0; n < n_samples; n++) {
 | 
			
		||||
				float c = s[0][n] + s[1][n];
 | 
			
		||||
				float w = c * mix->widen;
 | 
			
		||||
				d[0][n] = (s[0][n] - w) * v0;
 | 
			
		||||
				d[1][n] = (s[1][n] - w) * v1;
 | 
			
		||||
				d[2][n] = c;
 | 
			
		||||
				d[2][n] = c * 0.5f;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		lr4_process(&mix->lr4[3], d[3], d[2], v3, n_samples);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue