|
| 1 | +#[allow(clippy::too_many_arguments)] |
| 2 | +#[inline(always)] |
| 3 | +pub fn interpolate_step_single( |
| 4 | + in_slice: &[f32], |
| 5 | + out_slice: &mut [f32], |
| 6 | + out_stride: usize, |
| 7 | + out_sample: usize, |
| 8 | + oversample: usize, |
| 9 | + offset: usize, |
| 10 | + n: usize, |
| 11 | + sinc_table: &[f32], |
| 12 | + frac: f32, |
| 13 | +) { |
| 14 | + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
| 15 | + { |
| 16 | + if is_x86_feature_detected!("avx") { |
| 17 | + unsafe { |
| 18 | + avx_wrapper::interpolate_step_single( |
| 19 | + in_slice, out_slice, out_stride, out_sample, oversample, |
| 20 | + offset, n, sinc_table, frac, |
| 21 | + ); |
| 22 | + } |
| 23 | + return; |
| 24 | + } |
| 25 | + |
| 26 | + if is_x86_feature_detected!("sse3") { |
| 27 | + unsafe { |
| 28 | + sse3_wrapper::interpolate_step_single( |
| 29 | + in_slice, out_slice, out_stride, out_sample, oversample, |
| 30 | + offset, n, sinc_table, frac, |
| 31 | + ); |
| 32 | + } |
| 33 | + return; |
| 34 | + } |
| 35 | + } |
| 36 | + |
| 37 | + super::native::interpolate_step_single( |
| 38 | + in_slice, out_slice, out_stride, out_sample, oversample, offset, n, |
| 39 | + sinc_table, frac, |
| 40 | + ); |
| 41 | +} |
| 42 | + |
| 43 | +#[allow(clippy::too_many_arguments)] |
| 44 | +#[inline(always)] |
| 45 | +pub fn interpolate_step_double( |
| 46 | + in_slice: &[f32], |
| 47 | + out_slice: &mut [f32], |
| 48 | + out_stride: usize, |
| 49 | + out_sample: usize, |
| 50 | + oversample: usize, |
| 51 | + offset: usize, |
| 52 | + n: usize, |
| 53 | + sinc_table: &[f32], |
| 54 | + frac: f32, |
| 55 | +) { |
| 56 | + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
| 57 | + { |
| 58 | + if is_x86_feature_detected!("avx") { |
| 59 | + unsafe { |
| 60 | + avx_wrapper::interpolate_step_double( |
| 61 | + in_slice, out_slice, out_stride, out_sample, oversample, |
| 62 | + offset, n, sinc_table, frac, |
| 63 | + ); |
| 64 | + } |
| 65 | + return; |
| 66 | + } |
| 67 | + |
| 68 | + if is_x86_feature_detected!("sse3") { |
| 69 | + unsafe { |
| 70 | + sse3_wrapper::interpolate_step_double( |
| 71 | + in_slice, out_slice, out_stride, out_sample, oversample, |
| 72 | + offset, n, sinc_table, frac, |
| 73 | + ); |
| 74 | + } |
| 75 | + return; |
| 76 | + } |
| 77 | + } |
| 78 | + |
| 79 | + super::native::interpolate_step_double( |
| 80 | + in_slice, out_slice, out_stride, out_sample, oversample, offset, n, |
| 81 | + sinc_table, frac, |
| 82 | + ); |
| 83 | +} |
| 84 | + |
| 85 | +#[inline(always)] |
| 86 | +pub fn direct_step_single( |
| 87 | + in_slice: &[f32], |
| 88 | + out_slice: &mut [f32], |
| 89 | + out_stride: usize, |
| 90 | + out_sample: usize, |
| 91 | + n: usize, |
| 92 | + sinc_table: &[f32], |
| 93 | +) { |
| 94 | + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
| 95 | + { |
| 96 | + if is_x86_feature_detected!("avx") { |
| 97 | + unsafe { |
| 98 | + avx_wrapper::direct_step_single( |
| 99 | + in_slice, out_slice, out_stride, out_sample, n, sinc_table, |
| 100 | + ); |
| 101 | + } |
| 102 | + return; |
| 103 | + } |
| 104 | + |
| 105 | + if is_x86_feature_detected!("sse3") { |
| 106 | + unsafe { |
| 107 | + sse3_wrapper::direct_step_single( |
| 108 | + in_slice, out_slice, out_stride, out_sample, n, sinc_table, |
| 109 | + ); |
| 110 | + } |
| 111 | + return; |
| 112 | + } |
| 113 | + } |
| 114 | + |
| 115 | + super::native::direct_step_single( |
| 116 | + in_slice, out_slice, out_stride, out_sample, n, sinc_table, |
| 117 | + ); |
| 118 | +} |
| 119 | + |
| 120 | +#[inline(always)] |
| 121 | +pub fn direct_step_double( |
| 122 | + in_slice: &[f32], |
| 123 | + out_slice: &mut [f32], |
| 124 | + out_stride: usize, |
| 125 | + out_sample: usize, |
| 126 | + n: usize, |
| 127 | + sinc_table: &[f32], |
| 128 | +) { |
| 129 | + #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] |
| 130 | + { |
| 131 | + if is_x86_feature_detected!("avx") { |
| 132 | + unsafe { |
| 133 | + avx_wrapper::direct_step_double( |
| 134 | + in_slice, out_slice, out_stride, out_sample, n, sinc_table, |
| 135 | + ); |
| 136 | + } |
| 137 | + return; |
| 138 | + } |
| 139 | + |
| 140 | + if is_x86_feature_detected!("sse3") { |
| 141 | + unsafe { |
| 142 | + sse3_wrapper::direct_step_double( |
| 143 | + in_slice, out_slice, out_stride, out_sample, n, sinc_table, |
| 144 | + ); |
| 145 | + } |
| 146 | + return; |
| 147 | + } |
| 148 | + } |
| 149 | + |
| 150 | + super::native::direct_step_double( |
| 151 | + in_slice, out_slice, out_stride, out_sample, n, sinc_table, |
| 152 | + ); |
| 153 | +} |
| 154 | + |
| 155 | +mod avx_wrapper; |
| 156 | +mod sse3_wrapper; |
0 commit comments