[PATCH] Fix Speex Resampler multi channel mode

TS
Tobias Schlager
Wed, Aug 9, 2017 6:56 AM

Hi all,

this patch fixes the Speex resampler multi channel mode (e.g. stereo) by fixing the sample count calculation (which didn't resect the current channel count).

Regards
Tobias

Hi all, this patch fixes the Speex resampler multi channel mode (e.g. stereo) by fixing the sample count calculation (which didn't resect the current channel count). Regards Tobias
NI
Nanang Izzuddin
Thu, Aug 10, 2017 6:57 AM

Hi Tobias,

The speex_resampler_process_interleaved_int() seems to take (and return)
number of samples of all channels, so 'in_samples_per_frame' and
'out_samples_per_frame' should be set as samples of all channels too
(instead of samples of one channel as represented in the patch). So IMO the
current code is also suitable for multiple channels already. Please feel
free to clarify if you think otherwise.

BR,
nanang

On Wed, Aug 9, 2017 at 1:56 PM, Tobias Schlager <
Tobias.Schlager@lindenbaum.eu> wrote:

Hi all,

this patch fixes the Speex resampler multi channel mode (e.g. stereo) by
fixing the sample count calculation (which didn't resect the current
channel count).

Regards
Tobias


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Tobias, The speex_resampler_process_interleaved_int() seems to take (and return) number of samples **of all channels**, so 'in_samples_per_frame' and 'out_samples_per_frame' should be set as samples of all channels too (instead of samples of one channel as represented in the patch). So IMO the current code is also suitable for multiple channels already. Please feel free to clarify if you think otherwise. BR, nanang On Wed, Aug 9, 2017 at 1:56 PM, Tobias Schlager < Tobias.Schlager@lindenbaum.eu> wrote: > Hi all, > > this patch fixes the Speex resampler multi channel mode (e.g. stereo) by > fixing the sample count calculation (which didn't resect the current > channel count). > > Regards > Tobias > > > > _______________________________________________ > Visit our blog: http://blog.pjsip.org > > pjsip mailing list > pjsip@lists.pjsip.org > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org > >
TS
Tobias Schlager
Thu, Aug 10, 2017 7:37 AM

Hi Nanang,

in the header documentation [1] the in_len and out_len parameters for speex_resampler_process_interleaved_int() are documented as "This is all per-channel" which I read as *_len represents the number of samples per channel. Therefore, I think the number of channels must be respected in the samples_per_frame counts. We use a stereo setup that uses the Speex resampler (because of the licensing restrictions of libresample) and with the patch applied the resampler works flawless in stereo mode. Without the patch we got completely garbled sound.

As far as I can say, after these simple patches, we didn't have any problems using the Speex resampler. It's stable and the quality also seems to be very good. I think the resampler is a very good alternative for the people that can't use libresample.

Regards
Tobias

[1] ./pjproject/pjproject-2.6/third_party/speex/include/speex/speex_resampler.h

--

Lindenbaum GmbH
Dipl.-Inform. Tobias Schlager, Software Engineer
Erbprinzenstr. 4-12, 76133 Karlsruhe, Deutschland
Tel: +49 721 48 08 48 - 000, Fax: +49 721 48 08 48 - 801,
E-Mail: tobias.schlager@lindenbaum.eu

Firmensitz: Erbprinzenstr. 4-12, Eingang A, 76133 Karlsruhe
Registergericht: Amtsgericht Mannheim, HRB 706184
Geschäftsführer: Dr. Ralf Nikolai
Steuernummer: 35007/02060, USt. ID: DE 263797265

http://www.lindenbaum.eu


Von: pjsip [pjsip-bounces@lists.pjsip.org]" im Auftrag von "Nanang Izzuddin [nanang@pjsip.org]
Gesendet: Donnerstag, 10. August 2017 08:57
An: pjsip list
Betreff: Re: [pjsip] [PATCH] Fix Speex Resampler multi channel mode

Hi Tobias,

The speex_resampler_process_interleaved_int() seems to take (and return) number of samples of all channels, so 'in_samples_per_frame' and 'out_samples_per_frame' should be set as samples of all channels too (instead of samples of one channel as represented in the patch). So IMO the current code is also suitable for multiple channels already. Please feel free to clarify if you think otherwise.

BR,
nanang

On Wed, Aug 9, 2017 at 1:56 PM, Tobias Schlager <Tobias.Schlager@lindenbaum.eumailto:Tobias.Schlager@lindenbaum.eu> wrote:
Hi all,

this patch fixes the Speex resampler multi channel mode (e.g. stereo) by fixing the sample count calculation (which didn't resect the current channel count).

Regards
Tobias


Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@lists.pjsip.orgmailto:pjsip@lists.pjsip.org
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org

Hi Nanang, in the header documentation [1] the in_len and out_len parameters for speex_resampler_process_interleaved_int() are documented as "This is all per-channel" which I read as *_len represents the number of samples per channel. Therefore, I think the number of channels must be respected in the samples_per_frame counts. We use a stereo setup that uses the Speex resampler (because of the licensing restrictions of libresample) and with the patch applied the resampler works flawless in stereo mode. Without the patch we got completely garbled sound. As far as I can say, after these simple patches, we didn't have any problems using the Speex resampler. It's stable and the quality also seems to be very good. I think the resampler is a very good alternative for the people that can't use libresample. Regards Tobias [1] ./pjproject/pjproject-2.6/third_party/speex/include/speex/speex_resampler.h -- Lindenbaum GmbH Dipl.-Inform. Tobias Schlager, Software Engineer Erbprinzenstr. 4-12, 76133 Karlsruhe, Deutschland Tel: +49 721 48 08 48 - 000, Fax: +49 721 48 08 48 - 801, E-Mail: tobias.schlager@lindenbaum.eu Firmensitz: Erbprinzenstr. 4-12, Eingang A, 76133 Karlsruhe Registergericht: Amtsgericht Mannheim, HRB 706184 Geschäftsführer: Dr. Ralf Nikolai Steuernummer: 35007/02060, USt. ID: DE 263797265 http://www.lindenbaum.eu ________________________________ Von: pjsip [pjsip-bounces@lists.pjsip.org]" im Auftrag von "Nanang Izzuddin [nanang@pjsip.org] Gesendet: Donnerstag, 10. August 2017 08:57 An: pjsip list Betreff: Re: [pjsip] [PATCH] Fix Speex Resampler multi channel mode Hi Tobias, The speex_resampler_process_interleaved_int() seems to take (and return) number of samples *of all channels*, so 'in_samples_per_frame' and 'out_samples_per_frame' should be set as samples of all channels too (instead of samples of one channel as represented in the patch). So IMO the current code is also suitable for multiple channels already. Please feel free to clarify if you think otherwise. BR, nanang On Wed, Aug 9, 2017 at 1:56 PM, Tobias Schlager <Tobias.Schlager@lindenbaum.eu<mailto:Tobias.Schlager@lindenbaum.eu>> wrote: Hi all, this patch fixes the Speex resampler multi channel mode (e.g. stereo) by fixing the sample count calculation (which didn't resect the current channel count). Regards Tobias _______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@lists.pjsip.org<mailto:pjsip@lists.pjsip.org> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org