[xiph-commits] r12454 - in trunk/speex: include/speex libspeex

jm at svn.xiph.org jm at svn.xiph.org
Mon Feb 12 06:37:58 PST 2007


Author: jm
Date: 2007-02-12 06:37:55 -0800 (Mon, 12 Feb 2007)
New Revision: 12454

Modified:
   trunk/speex/include/speex/speex_resampler.h
   trunk/speex/libspeex/resample.c
Log:
Added interleave_int() call.


Modified: trunk/speex/include/speex/speex_resampler.h
===================================================================
--- trunk/speex/include/speex/speex_resampler.h	2007-02-12 14:12:59 UTC (rev 12453)
+++ trunk/speex/include/speex/speex_resampler.h	2007-02-12 14:37:55 UTC (rev 12454)
@@ -88,7 +88,7 @@
  */
 void speex_resampler_destroy(SpeexResamplerState *st);
 
-/** Resample a float array. The input and output may *not* alias.
+/** Resample a float array. The input and output buffers must *not* overlap.
  * @param st Resampler state
  * @param channel_index Index of the channel to process for the multi-channel base (0 otherwise)
  * @param in Input buffer
@@ -98,7 +98,7 @@
  */
 void speex_resampler_process_float(SpeexResamplerState *st, int channel_index, const float *in, int *in_len, float *out, int *out_len);
 
-/** Resample an int array. The input and output may *not* alias.
+/** Resample an int array. The input and output buffers must *not* overlap.
  * @param st Resampler state
  * @param channel_index Index of the channel to process for the multi-channel base (0 otherwise)
  * @param in Input buffer
@@ -108,7 +108,7 @@
  */
 void speex_resampler_process_int(SpeexResamplerState *st, int channel_index, const spx_int16_t *in, int *in_len, spx_int16_t *out, int *out_len);
 
-/** Resample an interleaved float array. The input and output may *not* alias.
+/** Resample an interleaved float array. The input and output buffers must *not* overlap.
  * @param st Resampler state
  * @param in Input buffer
  * @param in_len Number of input samples in the input buffer. Returns the number of samples processed. This is all per-channel.
@@ -117,6 +117,15 @@
  */
 void speex_resampler_process_interleaved_float(SpeexResamplerState *st, const float *in, int *in_len, float *out, int *out_len);
 
+/** Resample an interleaved int array. The input and output buffers must *not* overlap.
+ * @param st Resampler state
+ * @param in Input buffer
+ * @param in_len Number of input samples in the input buffer. Returns the number of samples processed. This is all per-channel.
+ * @param out Output buffer
+ * @param out_len Size of the output buffer. Returns the number of samples written. This is all per-channel.
+ */
+void speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, int *in_len, spx_int16_t *out, int *out_len);
+
 /** Set (change) the input/output sampling rates and resampling ratio.
  * @param st Resampler state
  * @param ratio_num Numerator of the sampling rate ratio

Modified: trunk/speex/libspeex/resample.c
===================================================================
--- trunk/speex/libspeex/resample.c	2007-02-12 14:12:59 UTC (rev 12453)
+++ trunk/speex/libspeex/resample.c	2007-02-12 14:37:55 UTC (rev 12454)
@@ -643,6 +643,20 @@
    st->out_stride = ostride_save;
 }
 
+void speex_resampler_process_interleaved_int(SpeexResamplerState *st, const spx_int16_t *in, int *in_len, spx_int16_t *out, int *out_len)
+{
+   int i;
+   int istride_save, ostride_save;
+   istride_save = st->in_stride;
+   ostride_save = st->out_stride;
+   st->in_stride = st->out_stride = st->nb_channels;
+   for (i=0;i<st->nb_channels;i++)
+   {
+      speex_resampler_process_int(st, i, in+i, in_len, out+i, out_len);
+   }
+   st->in_stride = istride_save;
+   st->out_stride = ostride_save;
+}
 
 void speex_resampler_set_rate(SpeexResamplerState *st, int ratio_num, int ratio_den, int in_rate, int out_rate)
 {



More information about the commits mailing list