FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
sbrdsp_template.c
Go to the documentation of this file.
1 /*
2  * AAC Spectral Band Replication decoding functions
3  * Copyright (c) 2008-2009 Robert Swain ( rob opendot cl )
4  * Copyright (c) 2009-2010 Alex Converse <alex.converse@gmail.com>
5  *
6  * This file is part of FFmpeg.
7  *
8  * FFmpeg is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2.1 of the License, or (at your option) any later version.
12  *
13  * FFmpeg is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with FFmpeg; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21  */
22 
23 static void sbr_sum64x5_c(INTFLOAT *z)
24 {
25  int k;
26  for (k = 0; k < 64; k++) {
27  INTFLOAT f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256];
28  z[k] = f;
29  }
30 }
31 
32 static void sbr_qmf_deint_bfly_c(INTFLOAT *v, const INTFLOAT *src0, const INTFLOAT *src1)
33 {
34  int i;
35  for (i = 0; i < 64; i++) {
36  v[ i] = AAC_SRA_R((src0[i] - src1[63 - i]), 5);
37  v[127 - i] = AAC_SRA_R((src0[i] + src1[63 - i]), 5);
38  }
39 }
40 
41 static void sbr_hf_apply_noise_0(INTFLOAT (*Y)[2], const AAC_FLOAT *s_m,
42  const AAC_FLOAT *q_filt, int noise,
43  int kx, int m_max)
44 {
45  sbr_hf_apply_noise(Y, s_m, q_filt, noise, (INTFLOAT)1.0, (INTFLOAT)0.0, m_max);
46 }
47 
48 static void sbr_hf_apply_noise_1(INTFLOAT (*Y)[2], const AAC_FLOAT *s_m,
49  const AAC_FLOAT *q_filt, int noise,
50  int kx, int m_max)
51 {
52  INTFLOAT phi_sign = 1 - 2 * (kx & 1);
53  sbr_hf_apply_noise(Y, s_m, q_filt, noise, (INTFLOAT)0.0, phi_sign, m_max);
54 }
55 
56 static void sbr_hf_apply_noise_2(INTFLOAT (*Y)[2], const AAC_FLOAT *s_m,
57  const AAC_FLOAT *q_filt, int noise,
58  int kx, int m_max)
59 {
60  sbr_hf_apply_noise(Y, s_m, q_filt, noise, (INTFLOAT)-1.0, (INTFLOAT)0.0, m_max);
61 }
62 
63 static void sbr_hf_apply_noise_3(INTFLOAT (*Y)[2], const AAC_FLOAT *s_m,
64  const AAC_FLOAT *q_filt, int noise,
65  int kx, int m_max)
66 {
67  INTFLOAT phi_sign = 1 - 2 * (kx & 1);
68  sbr_hf_apply_noise(Y, s_m, q_filt, noise, (INTFLOAT)0.0, -phi_sign, m_max);
69 }
70 
72 {
73  s->sum64x5 = sbr_sum64x5_c;
74  s->sum_square = sbr_sum_square_c;
75  s->neg_odd_64 = sbr_neg_odd_64_c;
76  s->qmf_pre_shuffle = sbr_qmf_pre_shuffle_c;
77  s->qmf_post_shuffle = sbr_qmf_post_shuffle_c;
78  s->qmf_deint_neg = sbr_qmf_deint_neg_c;
79  s->qmf_deint_bfly = sbr_qmf_deint_bfly_c;
80  s->autocorrelate = sbr_autocorrelate_c;
81  s->hf_gen = sbr_hf_gen_c;
82  s->hf_g_filt = sbr_hf_g_filt_c;
83 
84  s->hf_apply_noise[0] = sbr_hf_apply_noise_0;
85  s->hf_apply_noise[1] = sbr_hf_apply_noise_1;
86  s->hf_apply_noise[2] = sbr_hf_apply_noise_2;
87  s->hf_apply_noise[3] = sbr_hf_apply_noise_3;
88 
89 #if !USE_FIXED
90  if (ARCH_ARM)
92  if (ARCH_X86)
94  if (ARCH_MIPS)
96 #endif /* !USE_FIXED */
97 }
const char * s
Definition: avisynth_c.h:631
static void sbr_hf_g_filt_c(float(*Y)[2], const float(*X_high)[40][2], const float *g_filt, int m_max, intptr_t ixh)
Definition: sbrdsp.c:187
static void sbr_qmf_pre_shuffle_c(float *z)
Definition: sbrdsp.c:57
static float sbr_sum_square_c(float(*x)[2], int n)
Definition: sbrdsp.c:31
static void sbr_hf_apply_noise_1(INTFLOAT(*Y)[2], const AAC_FLOAT *s_m, const AAC_FLOAT *q_filt, int noise, int kx, int m_max)
static av_always_inline void sbr_hf_apply_noise(float(*Y)[2], const float *s_m, const float *q_filt, int noise, float phi_sign0, float phi_sign1, int m_max)
Definition: sbrdsp.c:198
static void sbr_hf_apply_noise_2(INTFLOAT(*Y)[2], const AAC_FLOAT *s_m, const AAC_FLOAT *q_filt, int noise, int kx, int m_max)
static void sbr_neg_odd_64_c(float *x)
Definition: sbrdsp.c:47
av_cold void ff_sbrdsp_init_arm(SBRDSPContext *s)
float INTFLOAT
Definition: aac_defines.h:85
av_cold void AAC_RENAME() ff_sbrdsp_init(SBRDSPContext *s)
#define av_cold
Definition: attributes.h:82
#define Y
Definition: vf_boxblur.c:76
static void sbr_qmf_deint_bfly_c(INTFLOAT *v, const INTFLOAT *src0, const INTFLOAT *src1)
static void sbr_hf_apply_noise_3(INTFLOAT(*Y)[2], const AAC_FLOAT *s_m, const AAC_FLOAT *q_filt, int noise, int kx, int m_max)
#define AAC_RENAME(x)
Definition: aac_defines.h:83
void ff_sbrdsp_init_mips(SBRDSPContext *s)
Definition: sbrdsp_mips.c:888
static void sbr_sum64x5_c(INTFLOAT *z)
float AAC_FLOAT
Definition: aac_defines.h:88
static void sbr_qmf_post_shuffle_c(float W[32][2], const float *z)
Definition: sbrdsp.c:74
static void sbr_autocorrelate_c(const float x[40][2], float phi[3][2][2])
Definition: sbrdsp.c:135
static int noise(AVBitStreamFilterContext *bsfc, AVCodecContext *avctx, const char *args, uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size, int keyframe)
Definition: noise_bsf.c:28
#define src1
Definition: h264pred.c:139
static void sbr_hf_apply_noise_0(INTFLOAT(*Y)[2], const AAC_FLOAT *s_m, const AAC_FLOAT *q_filt, int noise, int kx, int m_max)
static void sbr_hf_gen_c(float(*X_high)[2], const float(*X_low)[2], const float alpha0[2], const float alpha1[2], float bw, int start, int end)
Definition: sbrdsp.c:159
void ff_sbrdsp_init_x86(SBRDSPContext *s)
Definition: sbrdsp_init.c:59
#define src0
Definition: h264pred.c:138
static void sbr_qmf_deint_neg_c(float *v, const float *src)
Definition: sbrdsp.c:87
#define AAC_SRA_R(x, y)
Definition: aac_defines.h:110