mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-10-29 05:40:27 -04:00 
			
		
		
		
	channelmix: dont make FC from synthesized FC
When we have stereo and need to make FC, don't try to upmix the stereo into FC again. Fix unit test now that we create FC channels.
This commit is contained in:
		
							parent
							
								
									39716cdd44
								
							
						
					
					
						commit
						b7279a1728
					
				
					 2 changed files with 11 additions and 13 deletions
				
			
		|  | @ -206,6 +206,14 @@ static int make_matrix(struct channelmix *mix) | |||
| 	} | ||||
| 
 | ||||
| 	unassigned = src_mask & ~dst_mask; | ||||
| 	keep = dst_mask & ~src_mask; | ||||
| 
 | ||||
| 	if (!SPA_FLAG_IS_SET(mix->options, CHANNELMIX_OPTION_UPMIX)) | ||||
| 		keep = 0; | ||||
| 
 | ||||
| 	keep |= FRONT; | ||||
| 	if (mix->lfe_cutoff > 0.0f) | ||||
| 		keep |= _MASK(LFE); | ||||
| 
 | ||||
| 	spa_log_debug(mix->log, "unassigned downmix %08" PRIx64, unassigned); | ||||
| 
 | ||||
|  | @ -231,6 +239,7 @@ static int make_matrix(struct channelmix *mix) | |||
| 			_MATRIX(FC,FR) += SQRT1_2; | ||||
| 			if (src_mask & FRONT) | ||||
| 				_MATRIX(FC,FC) = clev * SQRT2; | ||||
| 			keep &= ~FRONT; | ||||
| 		} else { | ||||
| 			spa_log_warn(mix->log, "can't assign STEREO"); | ||||
| 		} | ||||
|  | @ -373,22 +382,11 @@ static int make_matrix(struct channelmix *mix) | |||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| 	keep = unassigned = dst_mask & ~src_mask; | ||||
| 	unassigned = dst_mask & ~src_mask & keep; | ||||
| 
 | ||||
| 	spa_log_debug(mix->log, "unassigned upmix %08"PRIx64" lfe:%f", | ||||
| 			unassigned, mix->lfe_cutoff); | ||||
| 
 | ||||
| 	if (!SPA_FLAG_IS_SET(mix->options, CHANNELMIX_OPTION_UPMIX)) | ||||
| 		keep = 0; | ||||
| 
 | ||||
| 	keep |= FRONT; | ||||
| 	if (mix->lfe_cutoff > 0.0f) | ||||
| 		keep |= _MASK(LFE); | ||||
| 
 | ||||
| 	unassigned &= keep; | ||||
| 
 | ||||
| 	spa_log_debug(mix->log, "final unassigned upmix %08" PRIx64, unassigned); | ||||
| 
 | ||||
| 	if (unassigned & FRONT) { | ||||
| 		if ((src_mask & STEREO) == STEREO) { | ||||
| 			spa_log_debug(mix->log, "produce FC from STEREO"); | ||||
|  |  | |||
|  | @ -162,7 +162,7 @@ static void test_4_N(void) | |||
| 	test_mix(4, _M(FL)|_M(FR)|_M(RL)|_M(RR), 4, _M(FL)|_M(FR)|_M(LFE)|_M(FC), | ||||
| 			MATRIX(1.0, 0.0, 0.707107, 0.0, | ||||
| 			       0.0, 1.0, 0.0, 0.707107, | ||||
| 			       0.0, 0.0, 0.0, 0.0, | ||||
| 			       0.707107, 0.707107, 0.0, 0.0, | ||||
| 			       0.0, 0.0, 0.0, 0.0)); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Wim Taymans
						Wim Taymans