slomo gst-plugins-base: gst-plugins-base/ gst-plugins-base/gst/speexresample/

[email protected]
Newsgroups gmane.comp.video.gstreamer.cvs
Message-ID <[email protected]>
CVS Root:       /cvs/gstreamer
Module:         gst-plugins-base
Changes by:     slomo
Date:           Fri Nov 28 2008  09:05:01 UTC

Log message:
* gst/speexresample/README:
Update README with the latest diff between the Speex resampler
and our copy.

Modified files:
    .               : ChangeLog
    gst/speexresample: README

Links:
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/ChangeLog.diff?r1=1.4224&r2=1.4225
http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins-base/gst/speexresample/README.diff?r1=1.3&r2=1.4

====Begin Diffs====
Index: ChangeLog
===================================================================
RCS file: /cvs/gstreamer/gst-plugins-base/ChangeLog,v
retrieving revision 1.4224
retrieving revision 1.4225
diff -u -d -r1.4224 -r1.4225
--- ChangeLog	28 Nov 2008 08:37:48 -0000	1.4224
+++ ChangeLog	28 Nov 2008 09:04:45 -0000	1.4225
@@ -1,5 +1,11 @@
 2008-11-28  Sebastian Dröge  <[email protected]>
 
+	* gst/speexresample/README:
+	Update README with the latest diff between the Speex resampler
+	and our copy.
+
+2008-11-28  Sebastian Dröge  <[email protected]>
 	* gst/speexresample/gstspeexresample.c: (plugin_init):
 	Update the debug category from speex_resample to audioresample.
Index: README
RCS file: /cvs/gstreamer/gst-plugins-base/gst/speexresample/README,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- README	28 Oct 2008 11:46:27 -0000	1.3
+++ README	28 Nov 2008 09:04:46 -0000	1.4
@@ -11,8 +11,8 @@
 The only changes are:
---- arch.h	2008-10-28 12:21:37.000000000 +0100
-+++ arch.h	2008-10-28 12:27:56.000000000 +0100
+--- arch.h	2008-11-28 09:57:15.000000000 +0100
++++ arch.h	2008-11-28 09:57:37.000000000 +0100
 @@ -78,7 +78,10 @@
  #include "../include/speex/speex_types.h"
  #endif
@@ -24,8 +24,45 @@
  #define ABS16(x) ((x) < 0 ? (-(x)) : (x))    /**< Absolute 16-bit value.  */
  #define MIN16(a,b) ((a) < (b) ? (a) : (b))   /**< Maximum 16-bit value.   */
  #define MAX16(a,b) ((a) > (b) ? (a) : (b))   /**< Maximum 16-bit value.   */
---- resample.c	2008-10-28 12:21:35.000000000 +0100
-+++ resample.c	2008-10-28 12:33:46.000000000 +0100
+@@ -134,6 +137,28 @@
+ 
+ #else
++#ifdef DOUBLE_PRECISION
++typedef double spx_mem_t;
++typedef double spx_coef_t;
++typedef double spx_lsp_t;
++typedef double spx_sig_t;
++typedef double spx_word16_t;
++typedef double spx_word32_t;
++
++#define Q15ONE 1.0
++#define LPC_SCALING  1.
++#define SIG_SCALING  1.
++#define LSP_SCALING  1.
++#define GAMMA_SCALING 1.
++#define GAIN_SCALING 1.
++#define GAIN_SCALING_1 1.
++#define VERY_SMALL 1e-20
++#define VERY_LARGE32 1e20
++#define VERY_LARGE16 1e20
++#define Q15_ONE ((spx_word16_t)1.)
++#else /* !DOUBLE_PRECISION */
+ typedef float spx_mem_t;
+ typedef float spx_coef_t;
+ typedef float spx_lsp_t;
+@@ -154,6 +179,7 @@
+ #define VERY_LARGE32 1e15f
+ #define VERY_LARGE16 1e15f
+ #define Q15_ONE ((spx_word16_t)1.f)
++#endif /* DOUBLE_PRECISION */
+ #define QCONST16(x,bits) (x)
+ #define QCONST32(x,bits) (x)
+--- resample.c	2008-11-28 09:56:42.000000000 +0100
++++ resample.c	2008-11-01 20:38:35.000000000 +0100
 @@ -63,22 +63,27 @@
  
  #ifdef OUTSIDE_SPEEX
@@ -34,7 +71,7 @@
 +
 +#include <glib.h>
-+#define EXPORT
++#define EXPORT G_GNUC_INTERNAL
 +static inline void *
  speex_alloc (int size)
@@ -68,8 +105,186 @@
  #include <math.h>
  #ifndef M_PI
---- speex_resampler.h	2008-10-28 12:21:37.000000000 +0100
-+++ speex_resampler.h	2008-10-28 12:30:48.000000000 +0100
+@@ -263,10 +267,17 @@
+ };
+ /*8,24,40,56,80,104,128,160,200,256,320*/
++static double
++compute_func (double x, struct FuncDef *func)
++{
++  double y, frac;
++#else
+ static double
+ compute_func (float x, struct FuncDef *func)
+ {
+   float y, frac;
++#endif
+   double interp[4];
+   int ind;
+   y = x * func->oversample;
+@@ -317,11 +328,19 @@
+ }
+ /* The slow way of computing a sinc for the table. Should improve that some day */
++static spx_word16_t
++sinc (double cutoff, double x, int N, struct FuncDef *window_func)
++  /*fprintf (stderr, "%f ", x); */
++  double xx = x * cutoff;
+ static spx_word16_t
+ sinc (float cutoff, float x, int N, struct FuncDef *window_func)
+   /*fprintf (stderr, "%f ", x); */
+   float xx = x * cutoff;
+   if (fabs (x) < 1e-6)
+     return cutoff;
+   else if (fabs (x) > .5 * N)
+@@ -372,6 +391,7 @@
+ #endif
++#ifndef DOUBLE_PRECISION
+ static int
+ resampler_basic_direct_single (SpeexResamplerState * st,
+     spx_uint32_t channel_index, const spx_word16_t * in, spx_uint32_t * in_len,
+@@ -421,6 +441,7 @@
+   st->samp_frac_num[channel_index] = samp_frac_num;
+   return out_sample;
+ #ifdef FIXED_POINT
+@@ -476,6 +497,7 @@
+ resampler_basic_interpolate_single (SpeexResamplerState * st,
+@@ -554,6 +576,7 @@
+@@ -584,10 +607,16 @@
+         PDIV32 (SHL32 ((samp_frac_num * st->oversample) % st->den_rate, 15),
+         st->den_rate);
++    const spx_word16_t frac =
++        ((double) ((samp_frac_num * st->oversample) % st->den_rate)) /
++        st->den_rate;
+     const spx_word16_t frac =
+         ((float) ((samp_frac_num * st->oversample) % st->den_rate)) /
+         st->den_rate;
+     spx_word16_t interp[4];
+@@ -688,20 +717,27 @@
+       spx_int32_t j;
+       for (j = 0; j < st->filt_len; j++) {
+         st->sinc_table[i * st->filt_len + j] =
+-            sinc (st->cutoff,
+-            ((j - (spx_int32_t) st->filt_len / 2 + 1) -
++            sinc (st->cutoff, ((j - (spx_int32_t) st->filt_len / 2 + 1) -
++                ((double) i) / st->den_rate), st->filt_len,
+                 ((float) i) / st->den_rate), st->filt_len,
+             quality_map[st->quality].window_func);
+       }
+     }
+     st->resampler_ptr = resampler_basic_direct_single;
++    st->resampler_ptr = resampler_basic_direct_double;
+     if (st->quality > 8)
+       st->resampler_ptr = resampler_basic_direct_double;
+     else
+       st->resampler_ptr = resampler_basic_direct_single;
+     /*fprintf (stderr, "resampler uses direct sinc table and normalised cutoff %f\n", cutoff); */
+   } else {
+     spx_int32_t i;
+@@ -717,16 +753,24 @@
+     for (i = -4; i < (spx_int32_t) (st->oversample * st->filt_len + 4); i++)
+       st->sinc_table[i + 4] =
++          sinc (st->cutoff, (i / (double) st->oversample - st->filt_len / 2),
+           sinc (st->cutoff, (i / (float) st->oversample - st->filt_len / 2),
+           st->filt_len, quality_map[st->quality].window_func);
+     st->resampler_ptr = resampler_basic_interpolate_single;
++    st->resampler_ptr = resampler_basic_interpolate_double;
+       st->resampler_ptr = resampler_basic_interpolate_double;
+       st->resampler_ptr = resampler_basic_interpolate_single;
+     /*fprintf (stderr, "resampler uses interpolated sinc table and normalised cutoff %f\n", cutoff); */
+   }
+   st->int_advance = st->num_rate / st->den_rate;
+@@ -956,11 +1000,18 @@
+     spx_uint32_t channel_index, const spx_int16_t * in, spx_uint32_t * in_len,
+     spx_int16_t * out, spx_uint32_t * out_len)
++EXPORT int
++speex_resampler_process_float (SpeexResamplerState * st,
++    spx_uint32_t channel_index, const double *in, spx_uint32_t * in_len,
++    double *out, spx_uint32_t * out_len)
+ EXPORT int
+ speex_resampler_process_float (SpeexResamplerState * st,
+     spx_uint32_t channel_index, const float *in, spx_uint32_t * in_len,
+     float *out, spx_uint32_t * out_len)
+   int j;
+   spx_uint32_t ilen = *in_len;
+@@ -1078,9 +1129,16 @@
+   return RESAMPLER_ERR_SUCCESS;
++speex_resampler_process_interleaved_float (SpeexResamplerState * st,
++    const double *in, spx_uint32_t * in_len, double *out,
++    spx_uint32_t * out_len)
+ speex_resampler_process_interleaved_float (SpeexResamplerState * st,
+     const float *in, spx_uint32_t * in_len, float *out, spx_uint32_t * out_len)
+   spx_uint32_t i;
+   int istride_save, ostride_save;
+--- speex_resampler.h	2008-11-28 09:57:15.000000000 +0100
++++ speex_resampler.h	2008-11-28 09:57:37.000000000 +0100
 @@ -77,10 +77,10 @@
  #define speex_resampler_reset_mem CAT_PREFIX(RANDOM_PREFIX,_resampler_reset_mem)
  #define speex_resampler_strerror CAT_PREFIX(RANDOM_PREFIX,_resampler_strerror)
@@ -85,3 +300,37 @@
  #else /* OUTSIDE_SPEEX */
+@@ -162,10 +162,17 @@
+  * @param out Output buffer
+  * @param out_len Size of the output buffer. Returns the number of samples written
+  */
++  int speex_resampler_process_float (SpeexResamplerState * st,
++      spx_uint32_t channel_index,
++      const double *in,
++      spx_uint32_t * in_len, double *out, spx_uint32_t * out_len);
+   int speex_resampler_process_float (SpeexResamplerState * st,
+       spx_uint32_t channel_index,
+       const float *in,
+       spx_uint32_t * in_len, float *out, spx_uint32_t * out_len);
+ /** Resample an int array. The input and output buffers must *not* overlap.
+  * @param st Resampler state
+@@ -191,9 +198,15 @@
+  * @param out_len Size of the output buffer. Returns the number of samples written.
+  * This is all per-channel.
++  int speex_resampler_process_interleaved_float (SpeexResamplerState * st,
+   int speex_resampler_process_interleaved_float (SpeexResamplerState * st,
+ /** Resample an interleaved int array. The input and output buffers must *not* overlap.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/

_______________________________________________
gstreamer-cvs-verbose mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gstreamer-cvs-verbose
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.