summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--gst-libs/gst/resample/resample.c24
-rw-r--r--gst-libs/gst/resample/resample.h10
3 files changed, 38 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 3f1cffe0..d06fe44d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2004-05-18 David Schleef <ds@schleef.org>
+ * gst-libs/gst/resample/resample.c: (gst_resample_sinc_ft_s16),
+ (gst_resample_sinc_ft_float): Remove use of static temporary
+ buffer. This code was obviously not supposed to last long, but
+ it's stuck in our ABI, so it required a little hack to make it
+ ABI-compatible. Fixes #142585.
+ * gst-libs/gst/resample/resample.h: same.
+
+2004-05-18 David Schleef <ds@schleef.org>
+
* configure.ac: Add sunaudio
* examples/Makefile.am: make gstplay depend on gconf
* gst/ffmpegcolorspace/gstffmpegcodecmap.c: Remove c99-isms
diff --git a/gst-libs/gst/resample/resample.c b/gst-libs/gst/resample/resample.c
index cc413e24..63ade390 100644
--- a/gst-libs/gst/resample/resample.c
+++ b/gst-libs/gst/resample/resample.c
@@ -252,7 +252,8 @@ gst_resample_nearest_s16 (gst_resample_t * r)
SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
break;
case 2:
- SCALE_LOOP (o_ptr[0] = i_ptr[0]; o_ptr[1] = i_ptr[1], 2);
+ SCALE_LOOP (o_ptr[0] = i_ptr[0];
+ o_ptr[1] = i_ptr[1], 2);
break;
default:
{
@@ -472,8 +473,6 @@ gst_resample_sinc_s16 (gst_resample_t * r)
static functable_t *ft;
-double out_tmp[10000];
-
void
gst_resample_sinc_ft_s16 (gst_resample_t * r)
{
@@ -493,6 +492,14 @@ gst_resample_sinc_ft_s16 (gst_resample_t * r)
double x, d;
double scale;
int n = 4;
+ double *out_tmp;
+
+ if (r->hack_union.s.out_tmp_len < r->o_samples) {
+ r->hack_union.s.out_tmp = realloc (r->hack_union.s.out_tmp,
+ r->o_samples * 2 * sizeof (double));
+ r->hack_union.s.out_tmp_len = r->o_samples;
+ }
+ out_tmp = r->hack_union.s.out_tmp;
scale = r->i_inc; /* cutoff at 22050 */
/*scale = 1.0; // cutoff at 24000 */
@@ -605,7 +612,8 @@ gst_resample_nearest_float (gst_resample_t * r)
SCALE_LOOP (o_ptr[0] = i_ptr[0], 1);
break;
case 2:
- SCALE_LOOP (o_ptr[0] = i_ptr[0]; o_ptr[1] = i_ptr[1], 2);
+ SCALE_LOOP (o_ptr[0] = i_ptr[0];
+ o_ptr[1] = i_ptr[1], 2);
break;
default:
{
@@ -805,6 +813,14 @@ gst_resample_sinc_ft_float (gst_resample_t * r)
double x, d;
double scale;
int n = 4;
+ double *out_tmp;
+
+ if (r->hack_union.s.out_tmp_len < r->o_samples) {
+ r->hack_union.s.out_tmp = realloc (r->hack_union.s.out_tmp,
+ r->o_samples * 2 * sizeof (double));
+ r->hack_union.s.out_tmp_len = r->o_samples;
+ }
+ out_tmp = r->hack_union.s.out_tmp;
scale = r->i_inc; /* cutoff at 22050 */
/*scale = 1.0; // cutoff at 24000 */
diff --git a/gst-libs/gst/resample/resample.h b/gst-libs/gst/resample/resample.h
index 1c4216b3..34d6f9d6 100644
--- a/gst-libs/gst/resample/resample.h
+++ b/gst-libs/gst/resample/resample.h
@@ -78,12 +78,20 @@ struct gst_resample_s {
void *i_buf, *o_buf;
- double acc[10];
+ double acc[2];
+ union {
+ struct {
+ double *out_tmp;
+ int out_tmp_len;
+ } s;
+ double padding[8];
+ } hack_union;
/* methods */
void (*scale)(gst_resample_t *r);
double ack;
+
};
void gst_resample_init(gst_resample_t *r);