Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jean-Marc Valin <jean-marc.valin@usherbrooke.ca>
To: James Courtier-Dutton <James@superbug.co.uk>
Cc: Takashi Iwai <tiwai@suse.de>, alsa-devel@lists.sourceforge.net
Subject: Re: Quality resampling code for libasound
Date: Wed, 21 Feb 2007 20:18:10 +1100	[thread overview]
Message-ID: <45DC0E52.1060805@usherbrooke.ca> (raw)
In-Reply-To: <45DB713F.9090804@superbug.co.uk>

[-- Attachment #1: Type: text/plain, Size: 931 bytes --]

> I've been having some problems with my plugin and trying to debug it,
> I've discovered what seems to be massive memory corruption in the rate
> converter plugin layer. It's actually not just with my plugin, but also
> with the libsamplerate plugin.

OK, so it turns out that the main bug wasn't in the plugin layer (though
it could definitely be more robust), but in the original rate_samplerate
plugin itself which had input_frames() and output_frames() actually
implemented in reverse.

So I'm attaching both a patch for rate_samplerate and a new version of
my resampler plugin (now BSD-licensed). Both seem to work much better
with the numerator and denominator in the right place. I still haven't
changed the code to resolve the symbol conflict, but I'll do that soon.

Can everyone give this a bit of testing? I hope we can soon get rid of
linear resampling as the default resampling once and for all.

Thanks,

	Jean-Marc

[-- Attachment #2: samplerate.patch --]
[-- Type: text/x-patch, Size: 614 bytes --]

--- rate_samplerate.c.old	2007-02-21 19:49:05.000000000 +1100
+++ rate_samplerate.c	2007-02-21 19:49:16.000000000 +1100
@@ -38,7 +38,7 @@
 	struct rate_src *rate = obj;
 	if (frames == 0)
 		return 0;
-	return (snd_pcm_uframes_t)(frames * rate->ratio);
+	return (snd_pcm_uframes_t)(frames / rate->ratio);
 }
 
 static snd_pcm_uframes_t output_frames(void *obj, snd_pcm_uframes_t frames)
@@ -46,7 +46,7 @@
 	struct rate_src *rate = obj;
 	if (frames == 0)
 		return 0;
-	return (snd_pcm_uframes_t)(frames / rate->ratio);
+	return (snd_pcm_uframes_t)(frames * rate->ratio);
 }
 
 static void pcm_src_free(void *obj)

[-- Attachment #3: pph.tar.gz --]
[-- Type: application/x-gzip, Size: 12297 bytes --]

[-- Attachment #4: Type: text/plain, Size: 345 bytes --]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

[-- Attachment #5: Type: text/plain, Size: 161 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/alsa-devel

  parent reply	other threads:[~2007-02-21  9:18 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-02-19  4:01 Quality resampling code for libasound Jean-Marc Valin
2007-02-19 12:23 ` Takashi Iwai
2007-02-19 12:54   ` Jean-Marc Valin
2007-02-19 13:10     ` Takashi Iwai
2007-02-19 13:38       ` Jean-Marc Valin
2007-02-19 13:47         ` Takashi Iwai
2007-02-20  5:53           ` Jean-Marc Valin
2007-02-20  6:48           ` Jean-Marc Valin
2007-02-20 10:45             ` Takashi Iwai
2007-02-20 11:54               ` Jean-Marc Valin
2007-02-20 12:13                 ` Takashi Iwai
2007-02-20 12:38                   ` Jean-Marc Valin
2007-02-20 21:50                     ` Fernando Lopez-Lezcano
2007-02-20 22:07                     ` James Courtier-Dutton
2007-02-20 22:45                       ` Jean-Marc Valin
2007-02-21  2:10                       ` Jean-Marc Valin
2007-02-21  9:18                       ` Jean-Marc Valin [this message]
2007-02-22 11:38                         ` Takashi Iwai
2007-02-22 11:48                           ` Jean-Marc Valin
2007-02-22 12:07                             ` Takashi Iwai
2007-02-28  2:10                               ` Jean-Marc Valin
2007-03-07 22:25                                 ` Takashi Iwai
2007-03-08  0:59                                   ` Jean-Marc Valin
2007-03-09 16:08                                     ` Takashi Iwai
2007-03-20 13:22                                       ` Jean-Marc Valin
2007-03-20 13:52                                         ` Takashi Iwai
2007-03-20 14:07                                           ` Jean-Marc Valin
2007-03-20 14:19                                             ` Takashi Iwai
     [not found]                                               ` <4600539A.2070804@usherbrooke.ca>
2007-03-21 11:23                                                 ` [Alsa-devel] " Takashi Iwai
2007-03-21 13:08                                                   ` Jean-Marc Valin
2007-03-21 13:14                                                     ` Takashi Iwai
2007-03-21 13:39                                                       ` Jean-Marc Valin
2007-03-21 13:59                                                         ` Takashi Iwai
2007-03-21 14:19                                                           ` Jean-Marc Valin
2007-03-21 14:53                                                             ` Takashi Iwai
2007-03-21 15:17                                                               ` Jean-Marc Valin
2007-03-21 15:43                                                                 ` Takashi Iwai
2007-03-21 15:27                                                       ` Rene Herman
2007-03-21 15:34                                                         ` Jean-Marc Valin
2007-03-21 16:38                                                           ` Rene Herman
2007-03-21 16:57                                                             ` Takashi Iwai
2007-03-21 17:24                                                               ` Takashi Iwai
2007-02-21 14:48                       ` Jean-Marc Valin
2007-02-19 13:11     ` Prakash Punnoor
2007-02-19 13:36       ` Adam Tlałka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=45DC0E52.1060805@usherbrooke.ca \
    --to=jean-marc.valin@usherbrooke.ca \
    --cc=James@superbug.co.uk \
    --cc=alsa-devel@lists.sourceforge.net \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox