Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
F
ffmpeg.wasm-core
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Linshizhi
ffmpeg.wasm-core
Commits
42d3fbb3
Commit
42d3fbb3
authored
Sep 22, 2009
by
Måns Rullgård
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AAC: use new dsputil functions
Originally committed as revision 19956 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
53b57211
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
38 deletions
+33
-38
aac.c
libavcodec/aac.c
+27
-32
aactab.c
libavcodec/aactab.c
+6
-6
No files found.
libavcodec/aac.c
View file @
42d3fbb3
...
@@ -861,18 +861,25 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
...
@@ -861,18 +861,25 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
for
(
group
=
0
;
group
<
ics
->
group_len
[
g
];
group
++
)
{
for
(
group
=
0
;
group
<
ics
->
group_len
[
g
];
group
++
)
{
float
scale
;
float
scale
;
float
band_energy
=
0
;
float
band_energy
=
0
;
float
*
cf
=
coef
+
group
*
128
;
int
len
=
offsets
[
i
+
1
]
-
offsets
[
i
];
for
(
k
=
offsets
[
i
];
k
<
offsets
[
i
+
1
];
k
++
)
{
for
(
k
=
offsets
[
i
];
k
<
offsets
[
i
+
1
];
k
++
)
{
ac
->
random_state
=
lcg_random
(
ac
->
random_state
);
ac
->
random_state
=
lcg_random
(
ac
->
random_state
);
coef
[
group
*
128
+
k
]
=
ac
->
random_state
;
coef
[
group
*
128
+
k
]
=
ac
->
random_state
;
band_energy
+=
coef
[
group
*
128
+
k
]
*
coef
[
group
*
128
+
k
];
}
}
band_energy
+=
ac
->
dsp
.
scalarproduct_float
(
cf
,
cf
,
len
);
scale
=
sf
[
idx
]
/
sqrtf
(
band_energy
);
scale
=
sf
[
idx
]
/
sqrtf
(
band_energy
);
for
(
k
=
offsets
[
i
];
k
<
offsets
[
i
+
1
];
k
++
)
{
ac
->
dsp
.
vector_fmul_scalar
(
cf
,
cf
,
scale
,
len
);
coef
[
group
*
128
+
k
]
*=
scale
;
}
}
}
}
else
{
}
else
{
for
(
group
=
0
;
group
<
ics
->
group_len
[
g
];
group
++
)
{
for
(
group
=
0
;
group
<
ics
->
group_len
[
g
];
group
++
)
{
const
float
*
vq
[
96
];
const
float
**
vqp
=
vq
;
float
*
cf
=
coef
+
(
group
<<
7
)
+
offsets
[
i
];
int
len
=
offsets
[
i
+
1
]
-
offsets
[
i
];
for
(
k
=
offsets
[
i
];
k
<
offsets
[
i
+
1
];
k
+=
dim
)
{
for
(
k
=
offsets
[
i
];
k
<
offsets
[
i
+
1
];
k
+=
dim
)
{
const
int
index
=
get_vlc2
(
gb
,
vlc_spectral
[
cur_band_type
-
1
].
table
,
6
,
3
);
const
int
index
=
get_vlc2
(
gb
,
vlc_spectral
[
cur_band_type
-
1
].
table
,
6
,
3
);
const
int
coef_tmp_idx
=
(
group
<<
7
)
+
k
;
const
int
coef_tmp_idx
=
(
group
<<
7
)
+
k
;
...
@@ -885,6 +892,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
...
@@ -885,6 +892,7 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
return
-
1
;
return
-
1
;
}
}
vq_ptr
=
&
ff_aac_codebook_vectors
[
cur_band_type
-
1
][
index
*
dim
];
vq_ptr
=
&
ff_aac_codebook_vectors
[
cur_band_type
-
1
][
index
*
dim
];
*
vqp
++
=
vq_ptr
;
if
(
is_cb_unsigned
)
{
if
(
is_cb_unsigned
)
{
if
(
vq_ptr
[
0
])
if
(
vq_ptr
[
0
])
coef
[
coef_tmp_idx
]
=
sign_lookup
[
get_bits1
(
gb
)];
coef
[
coef_tmp_idx
]
=
sign_lookup
[
get_bits1
(
gb
)];
...
@@ -912,29 +920,18 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
...
@@ -912,29 +920,18 @@ static int decode_spectrum_and_dequant(AACContext *ac, float coef[1024],
}
else
}
else
coef
[
coef_tmp_idx
+
j
]
*=
vq_ptr
[
j
];
coef
[
coef_tmp_idx
+
j
]
*=
vq_ptr
[
j
];
}
}
}
else
{
coef
[
coef_tmp_idx
]
*=
vq_ptr
[
0
];
coef
[
coef_tmp_idx
+
1
]
*=
vq_ptr
[
1
];
if
(
dim
==
4
)
{
coef
[
coef_tmp_idx
+
2
]
*=
vq_ptr
[
2
];
coef
[
coef_tmp_idx
+
3
]
*=
vq_ptr
[
3
];
}
}
}
}
else
{
coef
[
coef_tmp_idx
]
=
vq_ptr
[
0
];
coef
[
coef_tmp_idx
+
1
]
=
vq_ptr
[
1
];
if
(
dim
==
4
)
{
coef
[
coef_tmp_idx
+
2
]
=
vq_ptr
[
2
];
coef
[
coef_tmp_idx
+
3
]
=
vq_ptr
[
3
];
}
}
coef
[
coef_tmp_idx
]
*=
sf
[
idx
];
coef
[
coef_tmp_idx
+
1
]
*=
sf
[
idx
];
if
(
dim
==
4
)
{
coef
[
coef_tmp_idx
+
2
]
*=
sf
[
idx
];
coef
[
coef_tmp_idx
+
3
]
*=
sf
[
idx
];
}
}
}
}
if
(
is_cb_unsigned
&&
cur_band_type
!=
ESC_BT
)
{
ac
->
dsp
.
vector_fmul_sv_scalar
[
dim
>>
2
](
cf
,
cf
,
vq
,
sf
[
idx
],
len
);
}
else
if
(
is_cb_unsigned
&&
cur_band_type
==
ESC_BT
)
{
ac
->
dsp
.
vector_fmul_scalar
(
cf
,
cf
,
sf
[
idx
],
len
);
}
else
{
/* !is_cb_unsigned */
ac
->
dsp
.
sv_fmul_scalar
[
dim
>>
2
](
cf
,
vq
,
sf
[
idx
],
len
);
}
}
}
}
}
}
}
...
@@ -1103,23 +1100,21 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
...
@@ -1103,23 +1100,21 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
/**
/**
* Mid/Side stereo decoding; reference: 4.6.8.1.3.
* Mid/Side stereo decoding; reference: 4.6.8.1.3.
*/
*/
static
void
apply_mid_side_stereo
(
ChannelElement
*
cpe
)
static
void
apply_mid_side_stereo
(
AACContext
*
ac
,
ChannelElement
*
cpe
)
{
{
const
IndividualChannelStream
*
ics
=
&
cpe
->
ch
[
0
].
ics
;
const
IndividualChannelStream
*
ics
=
&
cpe
->
ch
[
0
].
ics
;
float
*
ch0
=
cpe
->
ch
[
0
].
coeffs
;
float
*
ch0
=
cpe
->
ch
[
0
].
coeffs
;
float
*
ch1
=
cpe
->
ch
[
1
].
coeffs
;
float
*
ch1
=
cpe
->
ch
[
1
].
coeffs
;
int
g
,
i
,
k
,
group
,
idx
=
0
;
int
g
,
i
,
group
,
idx
=
0
;
const
uint16_t
*
offsets
=
ics
->
swb_offset
;
const
uint16_t
*
offsets
=
ics
->
swb_offset
;
for
(
g
=
0
;
g
<
ics
->
num_window_groups
;
g
++
)
{
for
(
g
=
0
;
g
<
ics
->
num_window_groups
;
g
++
)
{
for
(
i
=
0
;
i
<
ics
->
max_sfb
;
i
++
,
idx
++
)
{
for
(
i
=
0
;
i
<
ics
->
max_sfb
;
i
++
,
idx
++
)
{
if
(
cpe
->
ms_mask
[
idx
]
&&
if
(
cpe
->
ms_mask
[
idx
]
&&
cpe
->
ch
[
0
].
band_type
[
idx
]
<
NOISE_BT
&&
cpe
->
ch
[
1
].
band_type
[
idx
]
<
NOISE_BT
)
{
cpe
->
ch
[
0
].
band_type
[
idx
]
<
NOISE_BT
&&
cpe
->
ch
[
1
].
band_type
[
idx
]
<
NOISE_BT
)
{
for
(
group
=
0
;
group
<
ics
->
group_len
[
g
];
group
++
)
{
for
(
group
=
0
;
group
<
ics
->
group_len
[
g
];
group
++
)
{
for
(
k
=
offsets
[
i
];
k
<
offsets
[
i
+
1
];
k
++
)
{
ac
->
dsp
.
butterflies_float
(
ch0
+
group
*
128
+
offsets
[
i
],
float
tmp
=
ch0
[
group
*
128
+
k
]
-
ch1
[
group
*
128
+
k
];
ch1
+
group
*
128
+
offsets
[
i
],
ch0
[
group
*
128
+
k
]
+=
ch1
[
group
*
128
+
k
];
offsets
[
i
+
1
]
-
offsets
[
i
]);
ch1
[
group
*
128
+
k
]
=
tmp
;
}
}
}
}
}
}
}
...
@@ -1200,7 +1195,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
...
@@ -1200,7 +1195,7 @@ static int decode_cpe(AACContext *ac, GetBitContext *gb, ChannelElement *cpe)
if
(
common_window
)
{
if
(
common_window
)
{
if
(
ms_present
)
if
(
ms_present
)
apply_mid_side_stereo
(
cpe
);
apply_mid_side_stereo
(
ac
,
cpe
);
if
(
ac
->
m4ac
.
object_type
==
AOT_AAC_MAIN
)
{
if
(
ac
->
m4ac
.
object_type
==
AOT_AAC_MAIN
)
{
apply_prediction
(
ac
,
&
cpe
->
ch
[
0
]);
apply_prediction
(
ac
,
&
cpe
->
ch
[
0
]);
apply_prediction
(
ac
,
&
cpe
->
ch
[
1
]);
apply_prediction
(
ac
,
&
cpe
->
ch
[
1
]);
...
...
libavcodec/aactab.c
View file @
42d3fbb3
...
@@ -409,7 +409,7 @@ const uint16_t ff_aac_spectral_sizes[11] = {
...
@@ -409,7 +409,7 @@ const uint16_t ff_aac_spectral_sizes[11] = {
* 64.0f is a special value indicating the existence of an escape code in the
* 64.0f is a special value indicating the existence of an escape code in the
* bitstream.
* bitstream.
*/
*/
static
const
float
codebook_vector0
[
324
]
=
{
static
const
DECLARE_ALIGNED_16
(
float
,
codebook_vector0
[
324
])
=
{
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
0
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
0
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
-
1
.
0000000
,
1
.
0000000
,
...
@@ -493,7 +493,7 @@ static const float codebook_vector0[324] = {
...
@@ -493,7 +493,7 @@ static const float codebook_vector0[324] = {
1
.
0000000
,
1
.
0000000
,
1
.
0000000
,
1
.
0000000
,
1
.
0000000
,
1
.
0000000
,
1
.
0000000
,
1
.
0000000
,
};
};
static
const
float
codebook_vector2
[
324
]
=
{
static
const
DECLARE_ALIGNED_16
(
float
,
codebook_vector2
[
324
])
=
{
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
1
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
1
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
2
.
5198421
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
2
.
5198421
,
...
@@ -577,7 +577,7 @@ static const float codebook_vector2[324] = {
...
@@ -577,7 +577,7 @@ static const float codebook_vector2[324] = {
2
.
5198421
,
2
.
5198421
,
2
.
5198421
,
2
.
5198421
,
2
.
5198421
,
2
.
5198421
,
2
.
5198421
,
2
.
5198421
,
};
};
static
const
float
codebook_vector4
[
162
]
=
{
static
const
DECLARE_ALIGNED_16
(
float
,
codebook_vector4
[
162
])
=
{
-
6
.
3496042
,
-
6
.
3496042
,
-
6
.
3496042
,
-
4
.
3267487
,
-
6
.
3496042
,
-
6
.
3496042
,
-
6
.
3496042
,
-
4
.
3267487
,
-
6
.
3496042
,
-
2
.
5198421
,
-
6
.
3496042
,
-
1
.
0000000
,
-
6
.
3496042
,
-
2
.
5198421
,
-
6
.
3496042
,
-
1
.
0000000
,
-
6
.
3496042
,
0
.
0000000
,
-
6
.
3496042
,
1
.
0000000
,
-
6
.
3496042
,
0
.
0000000
,
-
6
.
3496042
,
1
.
0000000
,
...
@@ -621,7 +621,7 @@ static const float codebook_vector4[162] = {
...
@@ -621,7 +621,7 @@ static const float codebook_vector4[162] = {
6
.
3496042
,
6
.
3496042
,
6
.
3496042
,
6
.
3496042
,
};
};
static
const
float
codebook_vector6
[
128
]
=
{
static
const
DECLARE_ALIGNED_16
(
float
,
codebook_vector6
[
128
])
=
{
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
1
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
1
.
0000000
,
0
.
0000000
,
2
.
5198421
,
0
.
0000000
,
4
.
3267487
,
0
.
0000000
,
2
.
5198421
,
0
.
0000000
,
4
.
3267487
,
0
.
0000000
,
6
.
3496042
,
0
.
0000000
,
8
.
5498797
,
0
.
0000000
,
6
.
3496042
,
0
.
0000000
,
8
.
5498797
,
...
@@ -656,7 +656,7 @@ static const float codebook_vector6[128] = {
...
@@ -656,7 +656,7 @@ static const float codebook_vector6[128] = {
13
.
3905183
,
10
.
9027236
,
13
.
3905183
,
13
.
3905183
,
13
.
3905183
,
10
.
9027236
,
13
.
3905183
,
13
.
3905183
,
};
};
static
const
float
codebook_vector8
[
338
]
=
{
static
const
DECLARE_ALIGNED_16
(
float
,
codebook_vector8
[
338
])
=
{
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
1
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
1
.
0000000
,
0
.
0000000
,
2
.
5198421
,
0
.
0000000
,
4
.
3267487
,
0
.
0000000
,
2
.
5198421
,
0
.
0000000
,
4
.
3267487
,
0
.
0000000
,
6
.
3496042
,
0
.
0000000
,
8
.
5498797
,
0
.
0000000
,
6
.
3496042
,
0
.
0000000
,
8
.
5498797
,
...
@@ -744,7 +744,7 @@ static const float codebook_vector8[338] = {
...
@@ -744,7 +744,7 @@ static const float codebook_vector8[338] = {
27
.
4731418
,
27
.
4731418
,
27
.
4731418
,
27
.
4731418
,
};
};
static
const
float
codebook_vector10
[
578
]
=
{
static
const
DECLARE_ALIGNED_16
(
float
,
codebook_vector10
[
578
])
=
{
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
1
.
0000000
,
0
.
0000000
,
0
.
0000000
,
0
.
0000000
,
1
.
0000000
,
0
.
0000000
,
2
.
5198421
,
0
.
0000000
,
4
.
3267487
,
0
.
0000000
,
2
.
5198421
,
0
.
0000000
,
4
.
3267487
,
0
.
0000000
,
6
.
3496042
,
0
.
0000000
,
8
.
5498797
,
0
.
0000000
,
6
.
3496042
,
0
.
0000000
,
8
.
5498797
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment