mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	channelmix: use front-center matrix values
Use the front-center matrix values to mix left and right.
This commit is contained in:
		
							parent
							
								
									c4e3b5adbc
								
							
						
					
					
						commit
						17fd38c3a5
					
				
					 1 changed files with 6 additions and 4 deletions
				
			
		| 
						 | 
					@ -237,6 +237,7 @@ channelmix_f32_2_3p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
 | 
				
			||||||
	const float **s = (const float **)src;
 | 
						const float **s = (const float **)src;
 | 
				
			||||||
	const float v0 = mix->matrix[0][0];
 | 
						const float v0 = mix->matrix[0][0];
 | 
				
			||||||
	const float v1 = mix->matrix[1][1];
 | 
						const float v1 = mix->matrix[1][1];
 | 
				
			||||||
 | 
						const float v2 = (mix->matrix[2][0] + mix->matrix[2][1]) * 0.5f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) {
 | 
						if (SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_ZERO)) {
 | 
				
			||||||
		for (i = 0; i < n_dst; i++)
 | 
							for (i = 0; i < n_dst; i++)
 | 
				
			||||||
| 
						 | 
					@ -246,7 +247,7 @@ channelmix_f32_2_3p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
 | 
				
			||||||
		for (n = 0; n < n_samples; n++) {
 | 
							for (n = 0; n < n_samples; n++) {
 | 
				
			||||||
			d[0][n] = s[0][n];
 | 
								d[0][n] = s[0][n];
 | 
				
			||||||
			d[1][n] = s[1][n];
 | 
								d[1][n] = s[1][n];
 | 
				
			||||||
			d[2][n] = (s[0][n] + s[1][n]) * 0.5f;
 | 
								d[2][n] = (s[0][n] + s[1][n]) * v2;
 | 
				
			||||||
			d[3][n] = 0.0f;
 | 
								d[3][n] = 0.0f;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -254,7 +255,7 @@ channelmix_f32_2_3p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
 | 
				
			||||||
		for (n = 0; n < n_samples; n++) {
 | 
							for (n = 0; n < n_samples; n++) {
 | 
				
			||||||
			d[0][n] = s[0][n] * v0;
 | 
								d[0][n] = s[0][n] * v0;
 | 
				
			||||||
			d[1][n] = s[1][n] * v1;
 | 
								d[1][n] = s[1][n] * v1;
 | 
				
			||||||
			d[2][n] = (d[0][n] + d[1][n]) * 0.5f;
 | 
								d[2][n] = (d[0][n] + d[1][n]) * v2;
 | 
				
			||||||
			d[3][n] = 0.0f;
 | 
								d[3][n] = 0.0f;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -270,6 +271,7 @@ channelmix_f32_2_5p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
 | 
				
			||||||
	const float **s = (const float **)src;
 | 
						const float **s = (const float **)src;
 | 
				
			||||||
	const float v0 = mix->matrix[0][0];
 | 
						const float v0 = mix->matrix[0][0];
 | 
				
			||||||
	const float v1 = mix->matrix[1][1];
 | 
						const float v1 = mix->matrix[1][1];
 | 
				
			||||||
 | 
						const float v2 = (mix->matrix[2][0] + mix->matrix[2][1]) * 0.5f;
 | 
				
			||||||
	const float v4 = mix->matrix[4][0];
 | 
						const float v4 = mix->matrix[4][0];
 | 
				
			||||||
	const float v5 = mix->matrix[5][1];
 | 
						const float v5 = mix->matrix[5][1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -281,7 +283,7 @@ channelmix_f32_2_5p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
 | 
				
			||||||
		for (n = 0; n < n_samples; n++) {
 | 
							for (n = 0; n < n_samples; n++) {
 | 
				
			||||||
			d[0][n] = d[4][n] = s[0][n];
 | 
								d[0][n] = d[4][n] = s[0][n];
 | 
				
			||||||
			d[1][n] = d[5][n] = s[1][n];
 | 
								d[1][n] = d[5][n] = s[1][n];
 | 
				
			||||||
			d[2][n] = (s[0][n] + s[1][n]) * 0.5f;
 | 
								d[2][n] = (s[0][n] + s[1][n]) * v2;
 | 
				
			||||||
			d[3][n] = 0.0f;
 | 
								d[3][n] = 0.0f;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -289,7 +291,7 @@ channelmix_f32_2_5p1_c(struct channelmix *mix, uint32_t n_dst, void * SPA_RESTRI
 | 
				
			||||||
		for (n = 0; n < n_samples; n++) {
 | 
							for (n = 0; n < n_samples; n++) {
 | 
				
			||||||
			d[0][n] = s[0][n] * v0;
 | 
								d[0][n] = s[0][n] * v0;
 | 
				
			||||||
			d[1][n] = s[1][n] * v1;
 | 
								d[1][n] = s[1][n] * v1;
 | 
				
			||||||
			d[2][n] = (d[0][n] + d[1][n]) * 0.5f;
 | 
								d[2][n] = (d[0][n] + d[1][n]) * v2;
 | 
				
			||||||
			d[3][n] = 0.0f;
 | 
								d[3][n] = 0.0f;
 | 
				
			||||||
			d[4][n] = s[0][n] * v4;
 | 
								d[4][n] = s[0][n] * v4;
 | 
				
			||||||
			d[5][n] = s[1][n] * v5;
 | 
								d[5][n] = s[1][n] * v5;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue