1cabdff1aSopenharmony_ci/*
2cabdff1aSopenharmony_ci * AAC Spectral Band Replication decoding functions
3cabdff1aSopenharmony_ci * Copyright (c) 2012 Christophe Gisquet <christophe.gisquet@gmail.com>
4cabdff1aSopenharmony_ci *
5cabdff1aSopenharmony_ci * This file is part of FFmpeg.
6cabdff1aSopenharmony_ci *
7cabdff1aSopenharmony_ci * FFmpeg is free software; you can redistribute it and/or
8cabdff1aSopenharmony_ci * modify it under the terms of the GNU Lesser General Public
9cabdff1aSopenharmony_ci * License as published by the Free Software Foundation; either
10cabdff1aSopenharmony_ci * version 2.1 of the License, or (at your option) any later version.
11cabdff1aSopenharmony_ci *
12cabdff1aSopenharmony_ci * FFmpeg is distributed in the hope that it will be useful,
13cabdff1aSopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
14cabdff1aSopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15cabdff1aSopenharmony_ci * Lesser General Public License for more details.
16cabdff1aSopenharmony_ci *
17cabdff1aSopenharmony_ci * You should have received a copy of the GNU Lesser General Public
18cabdff1aSopenharmony_ci * License along with FFmpeg; if not, write to the Free Software
19cabdff1aSopenharmony_ci * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20cabdff1aSopenharmony_ci */
21cabdff1aSopenharmony_ci
22cabdff1aSopenharmony_ci#include "config.h"
23cabdff1aSopenharmony_ci#include "libavutil/attributes.h"
24cabdff1aSopenharmony_ci#include "libavutil/cpu.h"
25cabdff1aSopenharmony_ci#include "libavutil/x86/cpu.h"
26cabdff1aSopenharmony_ci#include "libavcodec/sbrdsp.h"
27cabdff1aSopenharmony_ci
28cabdff1aSopenharmony_cifloat ff_sbr_sum_square_sse(float (*x)[2], int n);
29cabdff1aSopenharmony_civoid ff_sbr_sum64x5_sse(float *z);
30cabdff1aSopenharmony_civoid ff_sbr_hf_g_filt_sse(float (*Y)[2], const float (*X_high)[40][2],
31cabdff1aSopenharmony_ci                          const float *g_filt, int m_max, intptr_t ixh);
32cabdff1aSopenharmony_civoid ff_sbr_hf_gen_sse(float (*X_high)[2], const float (*X_low)[2],
33cabdff1aSopenharmony_ci                       const float alpha0[2], const float alpha1[2],
34cabdff1aSopenharmony_ci                       float bw, int start, int end);
35cabdff1aSopenharmony_civoid ff_sbr_neg_odd_64_sse(float *z);
36cabdff1aSopenharmony_civoid ff_sbr_qmf_post_shuffle_sse(float W[32][2], const float *z);
37cabdff1aSopenharmony_civoid ff_sbr_qmf_deint_bfly_sse2(float *v, const float *src0, const float *src1);
38cabdff1aSopenharmony_civoid ff_sbr_qmf_pre_shuffle_sse2(float *z);
39cabdff1aSopenharmony_ci
40cabdff1aSopenharmony_civoid ff_sbr_hf_apply_noise_0_sse2(float (*Y)[2], const float *s_m,
41cabdff1aSopenharmony_ci                                  const float *q_filt, int noise,
42cabdff1aSopenharmony_ci                                  int kx, int m_max);
43cabdff1aSopenharmony_civoid ff_sbr_hf_apply_noise_1_sse2(float (*Y)[2], const float *s_m,
44cabdff1aSopenharmony_ci                                  const float *q_filt, int noise,
45cabdff1aSopenharmony_ci                                  int kx, int m_max);
46cabdff1aSopenharmony_civoid ff_sbr_hf_apply_noise_2_sse2(float (*Y)[2], const float *s_m,
47cabdff1aSopenharmony_ci                                  const float *q_filt, int noise,
48cabdff1aSopenharmony_ci                                  int kx, int m_max);
49cabdff1aSopenharmony_civoid ff_sbr_hf_apply_noise_3_sse2(float (*Y)[2], const float *s_m,
50cabdff1aSopenharmony_ci                                  const float *q_filt, int noise,
51cabdff1aSopenharmony_ci                                  int kx, int m_max);
52cabdff1aSopenharmony_ci
53cabdff1aSopenharmony_civoid ff_sbr_qmf_deint_neg_sse(float *v, const float *src);
54cabdff1aSopenharmony_ci
55cabdff1aSopenharmony_civoid ff_sbr_autocorrelate_sse (const float x[40][2], float phi[3][2][2]);
56cabdff1aSopenharmony_civoid ff_sbr_autocorrelate_sse3(const float x[40][2], float phi[3][2][2]);
57cabdff1aSopenharmony_ci
58cabdff1aSopenharmony_ciav_cold void ff_sbrdsp_init_x86(SBRDSPContext *s)
59cabdff1aSopenharmony_ci{
60cabdff1aSopenharmony_ci    int cpu_flags = av_get_cpu_flags();
61cabdff1aSopenharmony_ci
62cabdff1aSopenharmony_ci    if (EXTERNAL_SSE(cpu_flags)) {
63cabdff1aSopenharmony_ci        s->neg_odd_64 = ff_sbr_neg_odd_64_sse;
64cabdff1aSopenharmony_ci        s->sum_square = ff_sbr_sum_square_sse;
65cabdff1aSopenharmony_ci        s->sum64x5    = ff_sbr_sum64x5_sse;
66cabdff1aSopenharmony_ci        s->hf_g_filt  = ff_sbr_hf_g_filt_sse;
67cabdff1aSopenharmony_ci        s->hf_gen     = ff_sbr_hf_gen_sse;
68cabdff1aSopenharmony_ci        s->qmf_post_shuffle = ff_sbr_qmf_post_shuffle_sse;
69cabdff1aSopenharmony_ci        s->qmf_deint_neg    = ff_sbr_qmf_deint_neg_sse;
70cabdff1aSopenharmony_ci        s->autocorrelate    = ff_sbr_autocorrelate_sse;
71cabdff1aSopenharmony_ci    }
72cabdff1aSopenharmony_ci
73cabdff1aSopenharmony_ci    if (EXTERNAL_SSE2(cpu_flags)) {
74cabdff1aSopenharmony_ci        s->qmf_deint_bfly   = ff_sbr_qmf_deint_bfly_sse2;
75cabdff1aSopenharmony_ci        s->qmf_pre_shuffle  = ff_sbr_qmf_pre_shuffle_sse2;
76cabdff1aSopenharmony_ci        s->hf_apply_noise[0] = ff_sbr_hf_apply_noise_0_sse2;
77cabdff1aSopenharmony_ci        s->hf_apply_noise[1] = ff_sbr_hf_apply_noise_1_sse2;
78cabdff1aSopenharmony_ci        s->hf_apply_noise[2] = ff_sbr_hf_apply_noise_2_sse2;
79cabdff1aSopenharmony_ci        s->hf_apply_noise[3] = ff_sbr_hf_apply_noise_3_sse2;
80cabdff1aSopenharmony_ci    }
81cabdff1aSopenharmony_ci
82cabdff1aSopenharmony_ci    if (EXTERNAL_SSE3(cpu_flags)) {
83cabdff1aSopenharmony_ci        s->autocorrelate = ff_sbr_autocorrelate_sse3;
84cabdff1aSopenharmony_ci    }
85cabdff1aSopenharmony_ci}
86