[FFmpeg-devel] [PATCH] Rewrite COMMON_CORE resampling loop.

Michael Niedermayer michaelni at gmx.at
Tue May 27 05:38:16 CEST 2014


On Tue, May 27, 2014 at 05:24:45AM +0200, Michael Niedermayer wrote:
> On Mon, May 26, 2014 at 06:09:56PM -0400, Ronald S. Bultje wrote:
> > This moves a condition in the loop outside. In one particular fate
> > test (fate-swr-resample-s32p-8000-2626), this makes the code about
> > 10% faster. It also simplifies the loop, allowing us to rewrite it
> > in yasm at some later point.
> > ---
> >  libswresample/resample_template.c | 30 ++++++++++++++++--------------
> >  1 file changed, 16 insertions(+), 14 deletions(-)
> > 
> > diff --git a/libswresample/resample_template.c b/libswresample/resample_template.c
> > index becff12..44fb667 100644
> > --- a/libswresample/resample_template.c
> > +++ b/libswresample/resample_template.c
> > @@ -135,34 +135,36 @@ int RENAME(swri_resample)(ResampleContext *c, DELEM *dst, const DELEM *src, int
> >          *consumed= index;
> >          index = 0;
> >      }else if(compensation_distance == 0 && !c->linear && index >= 0){
> > +        int64_t end_index = (1 + src_size - c->filter_length) << c->phase_shift;
> 
> the shift is 32bit, probably would be safer as 64bit
> 
> 
> > +        int64_t delta_frac = (end_index - index) * c->src_incr - c->frac;
> 
> cant this overflow ?

i realize now you said you posted a newer patch ;)
"lucky" that issue seems to be still in it so my review wasnt wasted

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Complexity theory is the science of finding the exact solution to an
approximation. Benchmarking OTOH is finding an approximation of the exact
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140527/62c566d0/attachment.asc>


More information about the ffmpeg-devel mailing list