audioresample: Fix up indention

This commit is contained in:
Sebastian Dröge 2014-04-15 19:16:44 +02:00
parent 5826f79980
commit 122446476f
2 changed files with 47 additions and 41 deletions

View file

@ -116,8 +116,7 @@ static void gst_audio_resample_set_property (GObject * object,
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,
@ -166,11 +165,12 @@ gst_audio_resample_class_init (GstAudioResampleClass * klass)
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,
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,
@ -211,7 +211,8 @@ gst_audio_resample_init (GstAudioResample * resample)
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);
@ -422,7 +423,8 @@ gst_audio_resample_update_state (GstAudioResample * resample, gint width,
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 =
@ -1387,14 +1389,16 @@ speex_resampler_sinc_filter_mode_get_type (void)
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_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" },
{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",
speex_resampler_sinc_filter_mode_type =
g_enum_register_static ("SpeexResamplerSincFilterMode",
sinc_filter_modes);
}
@ -1465,8 +1469,7 @@ _benchmark_integer_resampling (void)
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_AUTO_THRESHOLD_DEFAULT, NULL);
if (sta == NULL) {
GST_ERROR ("Failed to create float resampler state");
return FALSE;
@ -1474,8 +1477,7 @@ _benchmark_integer_resampling (void)
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_AUTO_THRESHOLD_DEFAULT, NULL);
if (stb == NULL) {
resample_float_resampler_destroy (sta);
GST_ERROR ("Failed to create int resampler state");

View file

@ -946,7 +946,8 @@ update_filter (SpeexResamplerState * st)
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,
@ -1072,9 +1073,12 @@ speex_resampler_init_frac (spx_uint32_t nb_channels, spx_uint32_t ratio_num,
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;
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);