static void gst_audio_resample_get_property (GObject * object,
guint prop_id, GValue * value, GParamSpec * pspec);
-static GType
-speex_resampler_sinc_filter_mode_get_type (void);
+static GType speex_resampler_sinc_filter_mode_get_type (void);
/* vmethods */
static gboolean gst_audio_resample_get_unit_size (GstBaseTransform * base,
SPEEX_RESAMPLER_SINC_FILTER_DEFAULT,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- g_object_class_install_property (gobject_class, PROP_SINC_FILTER_AUTO_THRESHOLD,
- g_param_spec_uint ("sinc-filter-auto-threshold", "Sinc filter auto mode threshold",
+ g_object_class_install_property (gobject_class,
+ PROP_SINC_FILTER_AUTO_THRESHOLD,
+ g_param_spec_uint ("sinc-filter-auto-threshold",
+ "Sinc filter auto mode threshold",
"Memory usage threshold to use if sinc filter mode is AUTO, given in bytes",
- 0, G_MAXUINT,
- SPEEX_RESAMPLER_SINC_FILTER_AUTO_THRESHOLD_DEFAULT,
- G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ 0, G_MAXUINT, SPEEX_RESAMPLER_SINC_FILTER_AUTO_THRESHOLD_DEFAULT,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&gst_audio_resample_src_template));
resample->quality = SPEEX_RESAMPLER_QUALITY_DEFAULT;
resample->sinc_filter_mode = SPEEX_RESAMPLER_SINC_FILTER_DEFAULT;
- resample->sinc_filter_auto_threshold = SPEEX_RESAMPLER_SINC_FILTER_AUTO_THRESHOLD_DEFAULT;
+ resample->sinc_filter_auto_threshold =
+ SPEEX_RESAMPLER_SINC_FILTER_AUTO_THRESHOLD_DEFAULT;
gst_base_transform_set_gap_aware (trans, TRUE);
gst_pad_set_query_function (trans->srcpad, gst_audio_resample_query);
const SpeexResampleFuncs *funcs = gst_audio_resample_get_funcs (width, fp);
ret = funcs->init (channels, inrate, outrate, quality,
- sinc_filter_mode, sinc_filter_auto_threshold, &err);
+ sinc_filter_mode, sinc_filter_auto_threshold, &err);
if (G_UNLIKELY (err != RESAMPLER_ERR_SUCCESS)) {
GST_ERROR_OBJECT (resample, "Failed to create resampler state: %s",
if (sinc_filter_mode == SPEEX_RESAMPLER_SINC_FILTER_AUTO) {
GST_INFO_OBJECT (resample, "Using the %s sinc filter table",
- funcs->get_sinc_filter_mode(ret) ? "full" : "interpolated");
+ funcs->get_sinc_filter_mode (ret) ? "full" : "interpolated");
}
funcs->skip_zeros (ret);
if (resample->state == NULL) {
ret = TRUE;
} else if (resample->channels != channels || fp != resample->fp
- || width != resample->width || sinc_filter_mode != resample->sinc_filter_mode
+ || width != resample->width
+ || sinc_filter_mode != resample->sinc_filter_mode
|| sinc_filter_auto_threshold != resample->sinc_filter_auto_threshold) {
resample->funcs->destroy (resample->state);
resample->state =
quality, resample->fp, resample->sinc_filter_mode,
resample->sinc_filter_auto_threshold);
break;
- case PROP_SINC_FILTER_MODE: {
+ case PROP_SINC_FILTER_MODE:{
/* FIXME locking! */
SpeexResamplerSincFilterMode sinc_filter_mode = g_value_get_enum (value);
break;
}
- case PROP_SINC_FILTER_AUTO_THRESHOLD: {
+ case PROP_SINC_FILTER_AUTO_THRESHOLD:{
/* FIXME locking! */
guint32 sinc_filter_auto_threshold = g_value_get_uint (value);
g_value_set_int (value, resample->quality);
break;
case PROP_SINC_FILTER_MODE:
- g_value_set_enum(value, resample->sinc_filter_mode);
+ g_value_set_enum (value, resample->sinc_filter_mode);
break;
case PROP_SINC_FILTER_AUTO_THRESHOLD:
- g_value_set_uint(value, resample->sinc_filter_auto_threshold);
+ g_value_set_uint (value, resample->sinc_filter_auto_threshold);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
if (!speex_resampler_sinc_filter_mode_type) {
static GEnumValue sinc_filter_modes[] = {
- { SPEEX_RESAMPLER_SINC_FILTER_INTERPOLATED, "Use interpolated sinc table", "interpolated" },
- { SPEEX_RESAMPLER_SINC_FILTER_FULL, "Use full sinc table", "full" },
- { SPEEX_RESAMPLER_SINC_FILTER_AUTO, "Use full table if table size below threshold", "auto" },
- { 0, NULL, NULL },
+ {SPEEX_RESAMPLER_SINC_FILTER_INTERPOLATED, "Use interpolated sinc table",
+ "interpolated"},
+ {SPEEX_RESAMPLER_SINC_FILTER_FULL, "Use full sinc table", "full"},
+ {SPEEX_RESAMPLER_SINC_FILTER_AUTO,
+ "Use full table if table size below threshold", "auto"},
+ {0, NULL, NULL},
};
- speex_resampler_sinc_filter_mode_type = g_enum_register_static (
- "SpeexResamplerSincFilterMode",
- sinc_filter_modes);
+ speex_resampler_sinc_filter_mode_type =
+ g_enum_register_static ("SpeexResamplerSincFilterMode",
+ sinc_filter_modes);
}
return speex_resampler_sinc_filter_mode_type;
orc_profile_init (&b);
sta = resample_float_resampler_init (1, 48000, 24000, 4,
- SPEEX_RESAMPLER_SINC_FILTER_INTERPOLATED,
- SPEEX_RESAMPLER_SINC_FILTER_AUTO_THRESHOLD_DEFAULT,
- NULL);
+ SPEEX_RESAMPLER_SINC_FILTER_INTERPOLATED,
+ SPEEX_RESAMPLER_SINC_FILTER_AUTO_THRESHOLD_DEFAULT, NULL);
if (sta == NULL) {
GST_ERROR ("Failed to create float resampler state");
return FALSE;
}
stb = resample_int_resampler_init (1, 48000, 24000, 4,
- SPEEX_RESAMPLER_SINC_FILTER_INTERPOLATED,
- SPEEX_RESAMPLER_SINC_FILTER_AUTO_THRESHOLD_DEFAULT,
- NULL);
+ SPEEX_RESAMPLER_SINC_FILTER_INTERPOLATED,
+ SPEEX_RESAMPLER_SINC_FILTER_AUTO_THRESHOLD_DEFAULT, NULL);
if (stb == NULL) {
resample_float_resampler_destroy (sta);
GST_ERROR ("Failed to create int resampler state");
const spx_word16_t *iptr = &in[last_sample];
SSE_FALLBACK (INNER_PRODUCT_SINGLE)
- NEON_FALLBACK (INNER_PRODUCT_SINGLE)
+ NEON_FALLBACK (INNER_PRODUCT_SINGLE)
sum = 0;
for (j = 0; j < N; j++)
sum += MULT16_16 (sinc[j], iptr[j]);
*/
#if defined(OVERRIDE_INNER_PRODUCT_SINGLE) && defined(_USE_NEON)
NEON_IMPLEMENTATION (INNER_PRODUCT_SINGLE)
- sum = inner_product_single (sinc, iptr, N);
- NEON_END(INNER_PRODUCT_SINGLE)
+ sum = inner_product_single (sinc, iptr, N);
+ NEON_END (INNER_PRODUCT_SINGLE)
#elif defined(OVERRIDE_INNER_PRODUCT_SINGLE) && defined(_USE_SSE)
SSE_IMPLEMENTATION (INNER_PRODUCT_SINGLE)
sum = inner_product_single (sinc, iptr, N);
SSE_END (INNER_PRODUCT_SINGLE)
#endif
- out[out_stride * out_sample++] = SATURATE32PSHR(sum, 15, 32767);
+ out[out_stride * out_sample++] = SATURATE32PSHR (sum, 15, 32767);
last_sample += int_advance;
samp_frac_num += frac_advance;
if (samp_frac_num >= den_rate) {
interp);
SSE_END (INTERPOLATE_PRODUCT_SINGLE)
#endif
- out[out_stride * out_sample++] = SATURATE32PSHR(sum, 14, 32767);
+ out[out_stride * out_sample++] = SATURATE32PSHR (sum, 14, 32767);
last_sample += int_advance;
samp_frac_num += frac_advance;
if (samp_frac_num >= den_rate) {
EXPORT SpeexResamplerState *
speex_resampler_init (spx_uint32_t nb_channels, spx_uint32_t in_rate,
- spx_uint32_t out_rate, int quality, SpeexResamplerSincFilterMode sinc_filter_mode,
+ spx_uint32_t out_rate, int quality,
+ SpeexResamplerSincFilterMode sinc_filter_mode,
spx_uint32_t sinc_filter_auto_threshold, int *err)
{
return speex_resampler_init_frac (nb_channels, in_rate, out_rate, in_rate,
if (sinc_filter_mode == RESAMPLER_SINC_FILTER_AUTO) {
/*
- Estimate how big the filter table would become if the full mode were to be used
- calculations used correspond to the ones in update_filter()
- if the size is bigger than the threshold, use interpolated sinc instead
- */
- spx_uint32_t base_filter_length = st->filt_len = quality_map[st->quality].base_length;
- spx_uint32_t filter_table_size = base_filter_length * st->den_rate * sizeof(spx_uint16_t);
- st->use_full_sinc_table = (filter_table_size > sinc_filter_auto_threshold) ? 0 : 1;
+ Estimate how big the filter table would become if the full mode were to be used
+ calculations used correspond to the ones in update_filter()
+ if the size is bigger than the threshold, use interpolated sinc instead
+ */
+ spx_uint32_t base_filter_length = st->filt_len =
+ quality_map[st->quality].base_length;
+ spx_uint32_t filter_table_size =
+ base_filter_length * st->den_rate * sizeof (spx_uint16_t);
+ st->use_full_sinc_table =
+ (filter_table_size > sinc_filter_auto_threshold) ? 0 : 1;
}
update_filter (st);