mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	filter-chain: use optimized sum
This commit is contained in:
		
							parent
							
								
									ca8bc59d0a
								
							
						
					
					
						commit
						f673764e58
					
				
					 1 changed files with 10 additions and 21 deletions
				
			
		| 
						 | 
					@ -420,8 +420,6 @@ void convolver_free(struct convolver *conv)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int convolver_run(struct convolver *conv, const float *input, float *output, int length)
 | 
					int convolver_run(struct convolver *conv, const float *input, float *output, int length)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	int i;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	convolver1_run(conv->headConvolver, input, output, length);
 | 
						convolver1_run(conv->headConvolver, input, output, length);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (conv->tailInput) {
 | 
						if (conv->tailInput) {
 | 
				
			||||||
| 
						 | 
					@ -431,24 +429,14 @@ int convolver_run(struct convolver *conv, const float *input, float *output, int
 | 
				
			||||||
			int remaining = length - processed;
 | 
								int remaining = length - processed;
 | 
				
			||||||
			int processing = SPA_MIN(remaining, conv->headBlockSize - (conv->tailInputFill % conv->headBlockSize));
 | 
								int processing = SPA_MIN(remaining, conv->headBlockSize - (conv->tailInputFill % conv->headBlockSize));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			const int sumBegin = processed;
 | 
								if (conv->tailPrecalculated0)
 | 
				
			||||||
			const int sumEnd = processed + processing;
 | 
									fft_sum(&output[processed], &output[processed],
 | 
				
			||||||
 | 
											&conv->tailPrecalculated0[conv->precalculatedPos],
 | 
				
			||||||
			if (conv->tailPrecalculated0) {
 | 
											processing);
 | 
				
			||||||
				int precalculatedPos = conv->precalculatedPos;
 | 
								if (conv->tailPrecalculated)
 | 
				
			||||||
				for (i = sumBegin; i < sumEnd; i++) {
 | 
									fft_sum(&output[processed], &output[processed],
 | 
				
			||||||
					output[i] += conv->tailPrecalculated0[precalculatedPos];
 | 
											&conv->tailPrecalculated[conv->precalculatedPos],
 | 
				
			||||||
					precalculatedPos++;
 | 
											processing);
 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			if (conv->tailPrecalculated) {
 | 
					 | 
				
			||||||
				int precalculatedPos = conv->precalculatedPos;
 | 
					 | 
				
			||||||
				for (i = sumBegin; i < sumEnd; i++) {
 | 
					 | 
				
			||||||
					output[i] += conv->tailPrecalculated[precalculatedPos];
 | 
					 | 
				
			||||||
					precalculatedPos++;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			conv->precalculatedPos += processing;
 | 
								conv->precalculatedPos += processing;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			fft_copy(conv->tailInput + conv->tailInputFill, input + processed, processing);
 | 
								fft_copy(conv->tailInput + conv->tailInputFill, input + processed, processing);
 | 
				
			||||||
| 
						 | 
					@ -467,7 +455,8 @@ int convolver_run(struct convolver *conv, const float *input, float *output, int
 | 
				
			||||||
			if (conv->tailPrecalculated &&
 | 
								if (conv->tailPrecalculated &&
 | 
				
			||||||
			    conv->tailInputFill == conv->tailBlockSize) {
 | 
								    conv->tailInputFill == conv->tailBlockSize) {
 | 
				
			||||||
				SPA_SWAP(conv->tailPrecalculated, conv->tailOutput);
 | 
									SPA_SWAP(conv->tailPrecalculated, conv->tailOutput);
 | 
				
			||||||
				convolver1_run(conv->tailConvolver, conv->tailInput, conv->tailOutput, conv->tailBlockSize);
 | 
									convolver1_run(conv->tailConvolver, conv->tailInput,
 | 
				
			||||||
 | 
											conv->tailOutput, conv->tailBlockSize);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if (conv->tailInputFill == conv->tailBlockSize) {
 | 
								if (conv->tailInputFill == conv->tailBlockSize) {
 | 
				
			||||||
				conv->tailInputFill = 0;
 | 
									conv->tailInputFill = 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue