1 /*
2 * Bluetooth low-complexity, subband codec (SBC)
3 *
4 * Copyright (C) 2017 Aurelien Jacobs <aurel@gnuage.org>
5 * Copyright (C) 2008-2010 Nokia Corporation
6 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
7 * Copyright (C) 2004-2005 Henryk Ploetz <henryk@ploetzli.ch>
8 * Copyright (C) 2005-2006 Brad Midgley <bmidgley@xmission.com>
9 *
10 * This file is part of FFmpeg.
11 *
12 * FFmpeg is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU Lesser General Public
14 * License as published by the Free Software Foundation; either
15 * version 2.1 of the License, or (at your option) any later version.
16 *
17 * FFmpeg is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 * Lesser General Public License for more details.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with FFmpeg; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 */
26
27 /**
28 * @file
29 * SBC MMX optimization for some basic "building bricks"
30 */
31
32 #include "libavutil/cpu.h"
33 #include "libavutil/x86/cpu.h"
34 #include "libavcodec/sbcdsp.h"
35
36 void ff_sbc_analyze_4_mmx(const int16_t *in, int32_t *out, const int16_t *consts);
37 void ff_sbc_analyze_8_mmx(const int16_t *in, int32_t *out, const int16_t *consts);
38 void ff_sbc_calc_scalefactors_mmx(int32_t sb_sample_f[16][2][8],
39 uint32_t scale_factor[2][8],
40 int blocks, int channels, int subbands);
41
ff_sbcdsp_init_x86(SBCDSPContext * s)42 av_cold void ff_sbcdsp_init_x86(SBCDSPContext *s)
43 {
44 int cpu_flags = av_get_cpu_flags();
45
46 if (EXTERNAL_MMX(cpu_flags)) {
47 s->sbc_analyze_4 = ff_sbc_analyze_4_mmx;
48 s->sbc_analyze_8 = ff_sbc_analyze_8_mmx;
49 s->sbc_calc_scalefactors = ff_sbc_calc_scalefactors_mmx;
50 }
51 }
52