[FFmpeg-devel] [PATCH] swr: handle initial negative sample index outside DSP function.

Ronald S. Bultje rsbultje at gmail.com
Wed Jun 11 13:58:24 CEST 2014


On Wed, Jun 11, 2014 at 7:44 AM, Michael Niedermayer <michaelni at gmx.at>

> On Tue, Jun 10, 2014 at 09:50:14PM -0400, Ronald S. Bultje wrote:
> > The new function in struct Resampler and code therefore in resample()
> > are admittedly butt-ugly. I'll probably clean it up but at least it
> > works so I figured I'd send it out and see what people think. What I'd
> > really like to do is to be able to expose ResampleContext to swresample.c
> > if people are OK with that.
> exposing it may be ok, but theres not always a ResampleContext
> we also support resampling through soxr (which uses a fft based
> resampler).
> i think the patch will break that due to
> invert_initial_buffer_func being NULL

Right - I don't want to duplicate all of that between resamplers though.
Probably best to change this function into something that tells me how many
samples to buffer+invert (which here is just -(c->index>>phase_shift) -
possibly for soxr it can always be 0 because it keeps handling that
internally). Then the logic for that can live in swresample.c - which
should also make the interactoin between swresample.c and resample.c

also this seems to give different output with
> ./ffmpeg -i matrixbench_mpeg2.mpg -af asetnsamples=1,aresample=8000 -t 30
> foo.wav
> vs.
> ./ffmpeg -i matrixbench_mpeg2.mpg -af asetnsamples=1024,aresample=8000 -t
> 30 foo.wav

Hm, ok, will fix.


More information about the ffmpeg-devel mailing list