Re: Look up table generation

From: Érico Nogueira <ericonr_at_disroot.org>
Date: Fri, 29 Jan 2021 01:29:51 -0300
I accidentally replied only to Alexandre, sorry.

Em 22/01/2021 08:06, Alexandre Ratchov escreveu:
> On Thu, Jan 21, 2021 at 10:29:19PM -0300, rico Nogueira wrote:
>> Hi!
>>
>> Commit 2996dcdc03e872c1534c15750a9f741c6afffbc0 [1] from the portable sndio
>> repository added a new resampling algorithm. Unfortunately, the origin of
>> the lookup table isn't clear. Would it be possible to include either the
>> script used to generate it (as well as other LUTs in the code), or some
>> reference links?
>>
> 
> Here's a program to generate the table. It's not very useful to work
> on the filter because one needs to plot the filter response, adjust
> manually parameters, experiment, etc. At least the program contains
> the exact formula and handles spacing.
> 
> Not sure what's better: ship the program or explain in detail how the
> filter works and how coefs are generated (or both)

I'd suggest both. Leaving the code itself as an "exercise to the reader" 
doesn't sound too terrible either, but it can lead to unnecessary 
friction in understanding what's going on. Pointing to the relevant 
literature is probably simpler than explaining the filter as a whole, 
though.

> 
>> Furthermore, would you be interested in patches to try and decrease the
>> amount of duplicated code between aucat/ and sndiod/, if it doesn't prove
>> too complicated to do?
>>
>> [1] https://github.com/ratchov/sndio/commit/2996dcdc03e872c1534c15750a9f741c6afffbc0
>>
> 
> Indeed dec_{mulaw,alaw,float}() could go in their own file leaving
> dsp.c almost the same. AFAICS, sndiod resampling bits are just a
> special case of aucat one (aucat needs to work with partial blocks
> while sndiod doesn't), so sndiod could be switched to use aucat
> resampler leaving both dsp.c the same.
> 
> For the Makefile tweakery to use a common source file we need to
> involve OpenBSD devs. But even if we don't go this way, reducing
> differences is always welcome

Do you think an internal libsndio-internal.a would make the OpenBSD part 
any easier? Otherwise I can stick with removing differences between the 
two files (or duplicating them exactly).

> 
> I'm using parts of aucat/sndiod in various $DAYJOB projects, and most
> problems are not caused by having multiple copies of the same file;
> the most annoying is to deal with small differences in mostly
> identical files with the same name.

That makes sense. So if using a single file for everything isn't 
possible, we can at least try to minimize the differences and make them 
as clear as possible.

> 
> My 2 cents
> 
Received on Fri Jan 29 2021 - 05:29:51 CET

This archive was generated by hypermail 2.3.0 : Sat Jan 30 2021 - 01:33:56 CET