2023-02-08 18:12:00 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								/* Spa */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								/* SPDX-License-Identifier: MIT */
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <math.h>
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <spa/utils/defs.h>
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-07 16:44:03 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <spa/support/log.h>
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "resample.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2025-09-07 16:44:03 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#undef SPA_LOG_TOPIC_DEFAULT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define SPA_LOG_TOPIC_DEFAULT &resample_log_topic
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								extern struct spa_log_topic resample_log_topic;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								typedef void (*resample_func_t)(struct resample *r,
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 16:43:06 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        const void * SPA_RESTRICT src[], uint32_t ioffs, uint32_t *in_len,
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        void * SPA_RESTRICT dst[], uint32_t ooffs, uint32_t *out_len);
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-03 17:46:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								struct resample_info {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t format;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									resample_func_t process_copy;
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-28 16:45:07 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									const char *copy_name;
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-03 17:46:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									resample_func_t process_full;
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-28 16:45:07 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									const char *full_name;
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-03 17:46:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									resample_func_t process_inter;
							 | 
						
					
						
							
								
									
										
										
										
											2022-06-28 16:45:07 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									const char *inter_name;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t cpu_flags;
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-03 17:46:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								struct native_data {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									double rate;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t n_taps;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t n_phases;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t in_rate;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t out_rate;
							 | 
						
					
						
							
								
									
										
										
										
											2024-02-16 13:42:31 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									float phase;
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-23 14:11:11 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									float pm;
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t inc;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t frac;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t filter_stride;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t filter_stride_os;
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-23 12:23:20 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t gcd;
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t hist;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									float **history;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									resample_func_t func;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									float *filter;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									float *hist_mem;
							 | 
						
					
						
							
								
									
										
										
										
											2020-04-03 17:46:04 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									const struct resample_info *info;
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-29 12:08:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#define DEFINE_RESAMPLER(type,arch)						\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								void do_resample_##type##_##arch(struct resample *r,				\
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 16:43:06 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									const void * SPA_RESTRICT src[], uint32_t ioffs, uint32_t *in_len,	\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void * SPA_RESTRICT dst[], uint32_t ooffs, uint32_t *out_len)
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 13:38:34 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#define MAKE_RESAMPLER_COPY(arch)						\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-29 12:08:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(copy,arch)							\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 13:38:34 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								{										\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct native_data *data = r->data;					\
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-05 13:10:00 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t index, n_taps = data->n_taps, n_taps2 = n_taps/2;		\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t c, olen = *out_len, ilen = *in_len, ch = r->channels;		\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 13:38:34 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
																		\
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 16:43:06 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									index = ioffs;								\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if (ooffs < olen && index + n_taps <= ilen) {				\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										uint32_t to_copy = SPA_MIN(olen - ooffs,			\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 13:38:34 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
												ilen - (index + n_taps) + 1);			\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										for (c = 0; c < ch; c++) {					\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 13:38:34 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											const float *s = src[c];				\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											float *d = dst[c];					\
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 16:43:06 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											spa_memcpy(&d[ooffs], &s[index + n_taps2],		\
							 | 
						
					
						
							
								
									
										
										
										
											2019-09-05 13:10:00 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
													to_copy * sizeof(float));		\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 13:38:34 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										}								\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										index += to_copy;						\
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 16:43:06 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										ooffs += to_copy;						\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 13:38:34 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}									\
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-30 15:14:05 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									*in_len = index;							\
							 | 
						
					
						
							
								
									
										
										
										
											2020-02-13 16:43:06 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									*out_len = ooffs;							\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 13:38:34 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#define INC(index,phase,n_phases) 						\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									index += inc;								\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									phase += frac;								\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									if (phase >= n_phases) {						\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										phase -= n_phases;						\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										index += 1;							\
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-20 15:04:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define MAKE_RESAMPLER_FULL(arch)						\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-29 12:08:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(full,arch)							\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{										\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct native_data *data = r->data;					\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 11:23:52 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t n_taps = data->n_taps, stride = data->filter_stride_os;	\
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-23 14:11:11 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t index, phase, out_rate = data->out_rate;			\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t c, o, olen = *out_len, ilen = *in_len;				\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t inc = data->inc, frac = data->frac, ch = r->channels;		\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
																		\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									index = ioffs;								\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									phase = (uint32_t)data->phase;						\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									for (o = ooffs; o < olen && index + n_taps <= ilen; o++) {		\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										float *filter = &data->filter[phase * stride];			\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for (c = 0; c < ch; c++) {					\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											const float *s = src[c];				\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											float *d = dst[c];					\
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-20 15:04:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											inner_product_##arch(&d[o], &s[index],			\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
													filter, n_taps);			\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}								\
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-23 14:11:11 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										INC(index, phase, out_rate);					\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}									\
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-02 23:06:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									*in_len = index;							\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									*out_len = o;								\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									data->phase = phase;							\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define MAKE_RESAMPLER_INTER(arch)						\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-29 12:08:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(inter,arch)							\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								{										\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct native_data *data = r->data;					\
							 | 
						
					
						
							
								
									
										
										
										
											2024-06-18 12:17:56 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t index, stride = data->filter_stride;				\
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-23 14:11:11 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t n_taps = data->n_taps, out_rate = data->out_rate;		\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									uint32_t c, o, olen = *out_len, ilen = *in_len;				\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									uint32_t inc = data->inc, frac = data->frac, ch = r->channels;          \
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-23 14:11:11 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									float phase, pm = data->pm;						\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
																		\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									index = ioffs;								\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									phase = data->phase;							\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									for (o = ooffs; o < olen && index + n_taps <= ilen; o++) {		\
							 | 
						
					
						
							
								
									
										
										
										
											2025-07-23 14:11:11 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										float ph = phase * pm;						\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										uint32_t offset = (uint32_t)floorf(ph);				\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										float *filter0 = &data->filter[(offset+0) * stride];		\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										float *filter1 = &data->filter[(offset+1) * stride];		\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										float pho = ph - offset;					\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										for (c = 0; c < ch; c++) {					\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											const float *s = src[c];				\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
											float *d = dst[c];					\
							 | 
						
					
						
							
								
									
										
										
										
											2022-11-20 15:04:02 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
											inner_product_ip_##arch(&d[o], &s[index],		\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
													filter0, filter1, pho, n_taps);		\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										}								\
							 | 
						
					
						
							
								
									
										
										
										
											2024-10-30 13:31:24 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										INC(index, phase, out_rate);					\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									}									\
							 | 
						
					
						
							
								
									
										
										
										
											2019-04-02 23:06:46 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									*in_len = index;							\
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-26 12:58:26 +01:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									*out_len = o;								\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									data->phase = phase;							\
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-29 12:08:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(copy,c);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(full,c);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(inter,c);
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2020-03-27 08:27:11 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#if defined (HAVE_NEON)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(full,neon);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(inter,neon);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#if defined (HAVE_SSE)
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-29 12:08:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(full,sse);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(inter,sse);
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#if defined (HAVE_SSSE3)
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-29 12:08:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(full,ssse3);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(inter,ssse3);
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-27 17:58:48 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#endif
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-28 16:45:57 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#if defined (HAVE_AVX) && defined(HAVE_FMA)
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-29 12:08:45 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(full,avx);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								DEFINE_RESAMPLER(inter,avx);
							 | 
						
					
						
							
								
									
										
										
										
											2019-03-28 16:45:57 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#endif
							 |