Directory: | ../../../ffmpeg/ |
---|---|
File: | src/libavcodec/sbrdsp_template.c |
Date: | 2022-07-04 19:11:22 |
Exec | Total | Coverage | |
---|---|---|---|
Lines: | 43 | 43 | 100.0% |
Branches: | 4 | 4 | 100.0% |
Line | Branch | Exec | Source |
---|---|---|---|
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 | 631587 | static void sbr_sum64x5_c(INTFLOAT *z) | |
24 | { | ||
25 | int k; | ||
26 |
2/2✓ Branch 0 taken 40421568 times.
✓ Branch 1 taken 631587 times.
|
41053155 | for (k = 0; k < 64; k++) { |
27 | 40421568 | INTFLOAT f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256]; | |
28 | 40421568 | z[k] = f; | |
29 | } | ||
30 | 631587 | } | |
31 | |||
32 | 548483 | static void sbr_qmf_deint_bfly_c(INTFLOAT *v, const INTFLOAT *src0, const INTFLOAT *src1) | |
33 | { | ||
34 | int i; | ||
35 |
2/2✓ Branch 0 taken 35102912 times.
✓ Branch 1 taken 548483 times.
|
35651395 | for (i = 0; i < 64; i++) { |
36 | #if USE_FIXED | ||
37 | 12353536 | v[ i] = (int)(0x10U + src0[i] - src1[63 - i]) >> 5; | |
38 | 12353536 | v[127 - i] = (int)(0x10U + src0[i] + src1[63 - i]) >> 5; | |
39 | #else | ||
40 | 22749376 | v[ i] = src0[i] - src1[63 - i]; | |
41 | 22749376 | v[127 - i] = src0[i] + src1[63 - i]; | |
42 | #endif | ||
43 | } | ||
44 | 548483 | } | |
45 | |||
46 | 82422 | static void sbr_hf_apply_noise_0(INTFLOAT (*Y)[2], const AAC_FLOAT *s_m, | |
47 | const AAC_FLOAT *q_filt, int noise, | ||
48 | int kx, int m_max) | ||
49 | { | ||
50 | 82422 | sbr_hf_apply_noise(Y, s_m, q_filt, noise, (INTFLOAT)1.0, (INTFLOAT)0.0, m_max); | |
51 | 82422 | } | |
52 | |||
53 | 82422 | static void sbr_hf_apply_noise_1(INTFLOAT (*Y)[2], const AAC_FLOAT *s_m, | |
54 | const AAC_FLOAT *q_filt, int noise, | ||
55 | int kx, int m_max) | ||
56 | { | ||
57 | 82422 | INTFLOAT phi_sign = 1 - 2 * (kx & 1); | |
58 | 82422 | sbr_hf_apply_noise(Y, s_m, q_filt, noise, (INTFLOAT)0.0, phi_sign, m_max); | |
59 | 82422 | } | |
60 | |||
61 | 82418 | static void sbr_hf_apply_noise_2(INTFLOAT (*Y)[2], const AAC_FLOAT *s_m, | |
62 | const AAC_FLOAT *q_filt, int noise, | ||
63 | int kx, int m_max) | ||
64 | { | ||
65 | 82418 | sbr_hf_apply_noise(Y, s_m, q_filt, noise, (INTFLOAT)-1.0, (INTFLOAT)0.0, m_max); | |
66 | 82418 | } | |
67 | |||
68 | 82418 | static void sbr_hf_apply_noise_3(INTFLOAT (*Y)[2], const AAC_FLOAT *s_m, | |
69 | const AAC_FLOAT *q_filt, int noise, | ||
70 | int kx, int m_max) | ||
71 | { | ||
72 | 82418 | INTFLOAT phi_sign = 1 - 2 * (kx & 1); | |
73 | 82418 | sbr_hf_apply_noise(Y, s_m, q_filt, noise, (INTFLOAT)0.0, -phi_sign, m_max); | |
74 | 82418 | } | |
75 | |||
76 | 373 | av_cold void AAC_RENAME(ff_sbrdsp_init)(SBRDSPContext *s) | |
77 | { | ||
78 | 373 | s->sum64x5 = sbr_sum64x5_c; | |
79 | 373 | s->sum_square = sbr_sum_square_c; | |
80 | 373 | s->neg_odd_64 = sbr_neg_odd_64_c; | |
81 | 373 | s->qmf_pre_shuffle = sbr_qmf_pre_shuffle_c; | |
82 | 373 | s->qmf_post_shuffle = sbr_qmf_post_shuffle_c; | |
83 | 373 | s->qmf_deint_neg = sbr_qmf_deint_neg_c; | |
84 | 373 | s->qmf_deint_bfly = sbr_qmf_deint_bfly_c; | |
85 | 373 | s->autocorrelate = sbr_autocorrelate_c; | |
86 | 373 | s->hf_gen = sbr_hf_gen_c; | |
87 | 373 | s->hf_g_filt = sbr_hf_g_filt_c; | |
88 | |||
89 | 373 | s->hf_apply_noise[0] = sbr_hf_apply_noise_0; | |
90 | 373 | s->hf_apply_noise[1] = sbr_hf_apply_noise_1; | |
91 | 373 | s->hf_apply_noise[2] = sbr_hf_apply_noise_2; | |
92 | 373 | s->hf_apply_noise[3] = sbr_hf_apply_noise_3; | |
93 | |||
94 | #if !USE_FIXED | ||
95 | #if ARCH_ARM | ||
96 | ff_sbrdsp_init_arm(s); | ||
97 | #elif ARCH_AARCH64 | ||
98 | ff_sbrdsp_init_aarch64(s); | ||
99 | #elif ARCH_X86 | ||
100 | 340 | ff_sbrdsp_init_x86(s); | |
101 | #elif ARCH_MIPS | ||
102 | ff_sbrdsp_init_mips(s); | ||
103 | #endif | ||
104 | #endif /* !USE_FIXED */ | ||
105 | 373 | } | |
106 |