Re: [PATCH v2 17/17] audio: remove sw->ratio

2023-02-22 Thread Marc-André Lureau
On Mon, Feb 6, 2023 at 10:53 PM Volker Rümelin wrote: > > Simplify the resample buffer size calculation. > > For audio playback we have > sw->ratio = ((int64_t)sw->hw->info.freq << 32) / sw->info.freq; > samples = ((int64_t)sw->HWBUF.size << 32) / sw->ratio; > > This can be simplified to > samples

[PATCH v2 17/17] audio: remove sw->ratio

2023-02-06 Thread Volker Rümelin
Simplify the resample buffer size calculation. For audio playback we have sw->ratio = ((int64_t)sw->hw->info.freq << 32) / sw->info.freq; samples = ((int64_t)sw->HWBUF.size << 32) / sw->ratio; This can be simplified to samples = muldiv64(sw->HWBUF.size, sw->info.freq, sw->hw->info.freq); For aud