[pulseaudio-discuss] resubmit reverted resampler patch
Peter Meerwald
pmeerw at pmeerw.net
Sun Jul 21 14:14:37 PDT 2013
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
regards, p.
More information about the pulseaudio-discuss
mailing list