[pulseaudio-discuss] resubmit reverted resampler patch

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Mon Nov 11 03:15:53 PST 2013


On Fri, 2013-11-08 at 10:44 +0200, Tanu Kaskinen wrote:
> On Sun, 2013-07-21 at 23:14 +0200, Peter Meerwald wrote:
> > Hello, 
> > 
> > the patch series aims to resubmit a patch to reorder the resampling 
> > pipeline; it former patch was dropped due to issues with leftover data 
> > handling; patch 11 has more details
> > 
> > the resampling pipeline is 
> > conv -> remap -> resample -> conv
> > 
> > patch 11 introduces the following, alternative pipeline
> > conv -> resample -> remap -> conv
> > when the number of input channels is less than the number of output channels
> > 
> > the resample stage may not consume all data passed; hence the leftover
> > data has to be stored; the data is presented again to the resample stage
> > together with the next input data
> > 
> > the strategy for the fix is to allow reinserting leftover data not only
> > in the remap stage, but also in the conv(to work format) stage; i.e. the
> > stage run before the resampler in case of the alternative pipeline
> > 
> > patches 1 and 2 introduce helper variables work_channels and w_fz
> > representing the number of channels and the byte per frame, respectively,
> > in the resample stage
> > 
> > patch 3 makes the impl_resample() function return the number of leftover
> > frames (to make leftover handling more visible in the code)
> > 
> > patch 4 move leftover handling from impl_resample() to resample()
> > 
> > patch 5 and 6 is cleanup and introduces a helper function fit_buf() for
> > buffer allocation
> > 
> > patch 7 introduces a pointer to the output buffer of the stage run before
> > the resamplers
> > 
> > patch 8 is cleanup
> > 
> > patch 9 extends fit_buf() so that it can copy leftover data when allocating
> > a new buffer
> > 
> > patch 10 adds leftover data handling to the convert_to_work_format()
> > function
> > 
> > patch 11 finally enables the two different pipelines; the patch is important
> > e.g. when a mono channel is remapped and resampled to quad-channel -- it
> > saves resampling 75% of the data!
> > 
> > 
> > 
> > I also considered moving the leftover handling into impl_resample(), but
> > this leads to more code duplication and buffer copying; new API to find the amount
> > of leftover data store in the resamplers might be needed as well
> > 
> > thanks to the cleanups preceding patch 11, the complexity of the more flexible 
> > pipeline keeps managable
> 
> I have rebased and reviewed patches 1-5, and all looked good, so pushed.
> I'll continue the review later (hopefully today).

I pushed patches 6, 7 and 8 too. Patch 9 had some issues (see my reply
to that patch), so I'm waiting for updated versions of patches 9-11.

-- 
Tanu



More information about the pulseaudio-discuss mailing list