On Mon, Dec 18, 2017 at 12:45:12PM +0100, Michael Niedermayer wrote: > On Sun, Dec 17, 2017 at 10:47:16PM +0100, Aurelien Jacobs wrote: > > This was originally based on libsbc, and was fully integrated into ffmpeg. > > --- > [...] > > +static inline void sbc_analyze_4b_4s_simd(SBCDSPContext *s, > > + int16_t *x, int32_t *out, int > > out_stride) > > +{ > > + /* Analyze blocks */ > > + s->sbc_analyze_4(x + 12, out, > > ff_sbcdsp_analysis_consts_fixed4_simd_odd); > > + out += out_stride; > > + s->sbc_analyze_4(x + 8, out, > > ff_sbcdsp_analysis_consts_fixed4_simd_even); > > + out += out_stride; > > + s->sbc_analyze_4(x + 4, out, > > ff_sbcdsp_analysis_consts_fixed4_simd_odd); > > + out += out_stride; > > + s->sbc_analyze_4(x + 0, out, > > ff_sbcdsp_analysis_consts_fixed4_simd_even); > > + > > + emms_c(); > > +} > > + > > +static inline void sbc_analyze_4b_8s_simd(SBCDSPContext *s, > > + int16_t *x, int32_t *out, int > > out_stride) > > +{ > > + /* Analyze blocks */ > > + s->sbc_analyze_8(x + 24, out, > > ff_sbcdsp_analysis_consts_fixed8_simd_odd); > > + out += out_stride; > > + s->sbc_analyze_8(x + 16, out, > > ff_sbcdsp_analysis_consts_fixed8_simd_even); > > + out += out_stride; > > + s->sbc_analyze_8(x + 8, out, > > ff_sbcdsp_analysis_consts_fixed8_simd_odd); > > + out += out_stride; > > + s->sbc_analyze_8(x + 0, out, > > ff_sbcdsp_analysis_consts_fixed8_simd_even); > > + > > + emms_c(); > > +} > > + > > +static inline void sbc_analyze_1b_8s_simd_even(SBCDSPContext *s, > > + int16_t *x, int32_t *out, > > + int out_stride); > > + > > +static inline void sbc_analyze_1b_8s_simd_odd(SBCDSPContext *s, > > + int16_t *x, int32_t *out, > > + int out_stride) > > +{ > > + s->sbc_analyze_8(x, out, ff_sbcdsp_analysis_consts_fixed8_simd_odd); > > + s->sbc_analyze_8s = sbc_analyze_1b_8s_simd_even; > > + > > + emms_c(); > > +} > > + > > +static inline void sbc_analyze_1b_8s_simd_even(SBCDSPContext *s, > > + int16_t *x, int32_t *out, > > + int out_stride) > > +{ > > + s->sbc_analyze_8(x, out, ff_sbcdsp_analysis_consts_fixed8_simd_even); > > + s->sbc_analyze_8s = sbc_analyze_1b_8s_simd_odd; > > + > > + emms_c(); > > +} > > at least some of the functions are always called in a loop, the emms_c() could > be called after the loop
Ok, I moved all those emms_c() out of the loop. > [...] > > diff --git a/libavcodec/sbcdsp_data.c b/libavcodec/sbcdsp_data.c > > new file mode 100644 > > index 0000000000..1e19b9d9d1 > > --- /dev/null > > +++ b/libavcodec/sbcdsp_data.c > > @@ -0,0 +1,329 @@ > > +/* > > + * Bluetooth low-complexity, subband codec (SBC) > > + * > > + * Copyright (C) 2017 Aurelien Jacobs <au...@gnuage.org> > > + * Copyright (C) 2008-2010 Nokia Corporation > > + * Copyright (C) 2004-2010 Marcel Holtmann <mar...@holtmann.org> > > + * Copyright (C) 2004-2005 Henryk Ploetz <hen...@ploetzli.ch> > > + * Copyright (C) 2005-2006 Brad Midgley <bmidg...@xmission.com> > > + * > > + * This file is part of FFmpeg. > > + * > > + * FFmpeg is free software; you can redistribute it and/or > > + * modify it under the terms of the GNU Lesser General Public > > + * License as published by the Free Software Foundation; either > > + * version 2.1 of the License, or (at your option) any later version. > > + * > > + * FFmpeg is distributed in the hope that it will be useful, > > + * but WITHOUT ANY WARRANTY; without even the implied warranty of > > + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > > + * Lesser General Public License for more details. > > + * > > + * You should have received a copy of the GNU Lesser General Public > > + * License along with FFmpeg; if not, write to the Free Software > > + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA > > 02110-1301 USA > > + */ > > + > > +/** > > + * @file > > + * miscellaneous SBC tables > > + */ > > + > > +#include "sbcdsp_data.h" > > + > > +#define F_PROTO(x) (int32_t) ((x * 2) * ((int32_t) 1 << 15) + 0.5) > > +#define F_COS(x) (int32_t) ((x ) * ((int32_t) 1 << 15) + 0.5) > > this needs more () to protect the argument x and the whole expression > for example F_PROTO(1+1) would produce unexpected results Indeed. Fixed in upcomming updated patch set. _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel