audioresample: Fix up indention
authorSebastian Dröge <sebastian@centricular.com>
Tue, 15 Apr 2014 17:16:44 +0000 (19:16 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Tue, 15 Apr 2014 17:31:28 +0000 (19:31 +0200)
gst/audioresample/gstaudioresample.c
gst/audioresample/resample.c

index e2a52eebd51920d297fb7385ff174dc027e91d48..94981bcea76950dee1ed5ce563b0c2cab204d34d 100644 (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,12 +165,13 @@ 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,
-           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));
@@ -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);
@@ -389,7 +390,7 @@ gst_audio_resample_init_state (GstAudioResample * resample, gint width,
   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",
@@ -399,7 +400,7 @@ gst_audio_resample_init_state (GstAudioResample * resample, gint width,
 
   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);
@@ -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 =
@@ -1328,7 +1330,7 @@ gst_audio_resample_set_property (GObject * object, guint prop_id,
           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);
 
@@ -1339,7 +1341,7 @@ gst_audio_resample_set_property (GObject * object, guint prop_id,
 
       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);
 
@@ -1369,10 +1371,10 @@ gst_audio_resample_get_property (GObject * object, guint prop_id,
       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);
@@ -1387,15 +1389,17 @@ 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_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;
@@ -1464,18 +1468,16 @@ _benchmark_integer_resampling (void)
   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");
index 11171216d7a457746f0a036b7dcf048cb360b812..ee6761793fed4617c0d3642603d6f5918c2906cd 100644 (file)
@@ -478,7 +478,7 @@ resampler_basic_direct_single (SpeexResamplerState * st,
     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]);
@@ -497,14 +497,14 @@ resampler_basic_direct_single (SpeexResamplerState * st,
 */
 #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) {
@@ -642,7 +642,7 @@ resampler_basic_interpolate_single (SpeexResamplerState * st,
         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) {
@@ -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,
@@ -1068,13 +1069,16 @@ speex_resampler_init_frac (spx_uint32_t nb_channels, spx_uint32_t ratio_num,
 
   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);