Re: Quality resampling code for libasound

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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
--- 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: pph.tar.gz
Description: GNU Zip compressed data

-------------------------------------------------------------------------
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
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux