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
1dece0d2
Commit
1dece0d2
authored
Aug 18, 2008
by
Robert Swain
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More OKed AAC decoder code hunks
Originally committed as revision 14829 to
svn://svn.ffmpeg.org/ffmpeg/trunk
parent
c7f4d983
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
0 deletions
+104
-0
aac.c
libavcodec/aac.c
+57
-0
aac.h
libavcodec/aac.h
+12
-0
aacdectab.h
libavcodec/aacdectab.h
+35
-0
No files found.
libavcodec/aac.c
View file @
1dece0d2
...
...
@@ -604,6 +604,44 @@ static void decode_pulses(Pulse * pulse, GetBitContext * gb, const uint16_t * sw
}
}
/**
* Decode Temporal Noise Shaping data; reference: table 4.48.
*
* @return Returns error status. 0 - OK, !0 - error
*/
static
int
decode_tns
(
AACContext
*
ac
,
TemporalNoiseShaping
*
tns
,
GetBitContext
*
gb
,
const
IndividualChannelStream
*
ics
)
{
int
w
,
filt
,
i
,
coef_len
,
coef_res
,
coef_compress
;
const
int
is8
=
ics
->
window_sequence
[
0
]
==
EIGHT_SHORT_SEQUENCE
;
const
int
tns_max_order
=
is8
?
7
:
ac
->
m4ac
.
object_type
==
AOT_AAC_MAIN
?
20
:
12
;
for
(
w
=
0
;
w
<
ics
->
num_windows
;
w
++
)
{
tns
->
n_filt
[
w
]
=
get_bits
(
gb
,
2
-
is8
);
if
(
tns
->
n_filt
[
w
])
coef_res
=
get_bits1
(
gb
);
for
(
filt
=
0
;
filt
<
tns
->
n_filt
[
w
];
filt
++
)
{
int
tmp2_idx
;
tns
->
length
[
w
][
filt
]
=
get_bits
(
gb
,
6
-
2
*
is8
);
if
((
tns
->
order
[
w
][
filt
]
=
get_bits
(
gb
,
5
-
2
*
is8
))
>
tns_max_order
)
{
av_log
(
ac
->
avccontext
,
AV_LOG_ERROR
,
"TNS filter order %d is greater than maximum %d."
,
tns
->
order
[
w
][
filt
],
tns_max_order
);
tns
->
order
[
w
][
filt
]
=
0
;
return
-
1
;
}
tns
->
direction
[
w
][
filt
]
=
get_bits1
(
gb
);
coef_compress
=
get_bits1
(
gb
);
coef_len
=
coef_res
+
3
-
coef_compress
;
tmp2_idx
=
2
*
coef_compress
+
coef_res
;
for
(
i
=
0
;
i
<
tns
->
order
[
w
][
filt
];
i
++
)
tns
->
coef
[
w
][
filt
][
i
]
=
tns_tmp2_map
[
tmp2_idx
][
get_bits
(
gb
,
coef_len
)];
}
}
return
0
;
}
/**
* Decode Mid/Side data; reference: table 4.54.
*
...
...
@@ -1066,6 +1104,25 @@ static int decode_extension_payload(AACContext * ac, GetBitContext * gb, int cnt
return
res
;
}
start
=
ics
->
swb_offset
[
FFMIN
(
bottom
,
mmm
)];
end
=
ics
->
swb_offset
[
FFMIN
(
top
,
mmm
)];
if
((
size
=
end
-
start
)
<=
0
)
continue
;
if
(
tns
->
direction
[
w
][
filt
])
{
inc
=
-
1
;
start
=
end
-
1
;
}
else
{
inc
=
1
;
}
start
+=
w
*
128
;
// ar filter
for
(
m
=
0
;
m
<
size
;
m
++
,
start
+=
inc
)
for
(
i
=
1
;
i
<=
FFMIN
(
m
,
order
);
i
++
)
coef
[
start
]
-=
coef
[
start
-
i
*
inc
]
*
lpc
[
i
];
}
}
}
/**
* Conduct IMDCT and windowing.
*/
...
...
libavcodec/aac.h
View file @
1dece0d2
...
...
@@ -148,6 +148,18 @@ typedef struct {
int
tns_max_bands
;
}
IndividualChannelStream
;
/**
* Temporal Noise Shaping
*/
typedef
struct
{
int
present
;
int
n_filt
[
8
];
int
length
[
8
][
4
];
int
direction
[
8
][
4
];
int
order
[
8
][
4
];
float
coef
[
8
][
4
][
TNS_MAX_ORDER
];
}
TemporalNoiseShaping
;
/**
* Dynamic Range Control - decoded from the bitstream but not processed further.
*/
...
...
libavcodec/aacdectab.h
View file @
1dece0d2
...
...
@@ -171,4 +171,39 @@ static const uint8_t tns_max_bands_128[] = {
};
// @}
/* @name tns_tmp2_map
* Tables of the tmp2[] arrays of LPC coefficients used for TNS.
* The suffix _M_N[] indicate the values of coef_compress and coef_res
* respectively.
* @{
*/
static
const
float
tns_tmp2_map_1_3
[
4
]
=
{
0
.
00000000
,
0
.
43388373
,
-
0
.
64278758
,
-
0
.
34202015
,
};
static
const
float
tns_tmp2_map_0_3
[
8
]
=
{
0
.
00000000
,
0
.
43388373
,
0
.
78183150
,
0
.
97492790
,
-
0
.
98480773
,
-
0
.
86602539
,
-
0
.
64278758
,
-
0
.
34202015
,
};
static
const
float
tns_tmp2_map_1_4
[
8
]
=
{
0
.
00000000
,
0
.
20791170
,
0
.
40673664
,
0
.
58778524
,
-
0
.
67369562
,
-
0
.
52643216
,
-
0
.
36124167
,
-
0
.
18374951
,
};
static
const
float
tns_tmp2_map_0_4
[
16
]
=
{
0
.
00000000
,
0
.
20791170
,
0
.
40673664
,
0
.
58778524
,
0
.
74314481
,
0
.
86602539
,
0
.
95105654
,
0
.
99452192
,
-
0
.
99573416
,
-
0
.
96182561
,
-
0
.
89516330
,
-
0
.
79801720
,
-
0
.
67369562
,
-
0
.
52643216
,
-
0
.
36124167
,
-
0
.
18374951
,
};
static
const
float
*
tns_tmp2_map
[
4
]
=
{
tns_tmp2_map_0_3
,
tns_tmp2_map_0_4
,
tns_tmp2_map_1_3
,
tns_tmp2_map_1_4
};
// @}
#endif
/* FFMPEG_AACDECTAB_H */
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